Re: bash command substitution problem
Incoming from Pollywog:
> 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-------'
>
>
> What am I doing wrong?
You're passing it "/bin/ls -l" instead of "/bin/ls". "-l" works in the
function to pick up files only, but fails in chmod (you can't "chmod 600
-rw-r--r-- 1 keeling keeling 5973 Oct 7 2004 .emacs". You
have to "chmod 600 .emacs".
--
Any technology distinguishable from magic is insufficiently advanced.
(*) http://www.spots.ab.ca/~keeling Please don't Cc: me.
- -
Reply to: