Space filename.

Mindig elgondolkodtat, hogy mi a logika a Bash gyakorlatában, miszerint space-szel tagolt filenevet tagonként listázunk, nem egyben. Tehát adott folderben kiadva ezt (az idézőjel ott van, vagy nincs – mindegy):

for i in $( ls -1 . ); do echo „$i”;done

Ezt kapom:

lipi@amenhotep:test$ for i in $( ls -1 . ); do echo „$i”;done
bim
bam
szu
net

Míg (helyes megoldás) ezt kiadva:

for i in *; do echo „$i”;done

Megkapom a valós tartalmat:

lipi@amenhotep:test$ for i in *; do echo „$i”;done
bim bam
szu net

Egyrészt mindig elfelejtem, hogy így van (hence the post), másrészt hülyeség. Szerintem.

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny