[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash command substitution problem



Incoming from Pollywog:
> On Sunday 08 May 2005 04:52 pm, s. keeling wrote:
> 
> >
> > 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".
> 
> Back to the drawing board then.  

Play with this:

   -------------------------------------
#!/usr/bin/zsh
#
#  list CWD contents, describing what they are.
#
#   8May2005   s. keeling   0001   start.
# ----------------------------------------------------
# 

for f in ./.?*; do
  if [ -L "${f}" ]; then
    echo "link:                     ${f}"
  elif [ -d "${f}" ]; then
    echo "dir:                      ${f}"
  elif [ -f "${f}" ]; then
    echo "real file:                ${f}"
  else
    echo "other:                    ${f}"
  fi
done
   -------------------------------------




-- 
Any technology distinguishable from magic is insufficiently advanced.
(*)    http://www.spots.ab.ca/~keeling      Please don't Cc: me.
- -



Reply to: