Re: bash command substitution problem
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Pollywog said:
> I have a function defined in my .bashrc as:
>
> function lf { /bin/ls -l | grep "^-" ; }
>
> It prints the files in the CWD without listing other directories.
>
> Suppose I want to 'chmod 600' all the files in the CWD without affecting
> directories, I try this:
>
> chmod 600 `lf`
>
> but I get this error:
> chmod: invalid character `w' in mode string `-rw-------'
yeah, the ls -l listing is getting you when you display.
try this one.
function lsf {
for i in *; do
if [ -f "$i" ]; then
echo "$i"
fi;
done;
}
lsf | xargs chmod 600
- --
/phil
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)
iD8DBQFCfkd9Gbd/rBLcaFwRAgfQAKCBtJmVZNChY7s2FaUYr2mJEV3xPACgwiUz
bgYxqBS+OoFekcHkXaDM8Sw=
=lB4T
-----END PGP SIGNATURE-----
Reply to: