Hello Shell Experts,
In the following, the echo output is right, but the pgm is not receiving the flags correctly. Appreciate any insights.
script file:
flags="-umc -v -v "
r="";for d in `ls -d /tmp/passenger*`; do r="$r -x $d"; done
flags="$flags $r"
echo $flags
/usr/sbin/tmpwatch "$flags" -x /tmp/.X11-unix -x /tmp/.XIM-unix \
-x /tmp/.font-unix -x /tmp/.ICE-unix -x /tmp/.Test-unix 240 /tmp
Output of sh -x < script
sh -x < ./tmpwatch
+ flags='-umc -v -v '
+ r=
++ ls -d /tmp/passenger.15264
+ for d in '`ls -d /tmp/passenger*`'
+ r=' -x /tmp/passenger.15264'
+ flags='-umc -v -v -x /tmp/passenger.15264'
+ echo -umc -v -v -x /tmp/passenger.15264
-umc -v -v -x /tmp/passenger.15264
+ /usr/sbin/tmpwatch '-umc -v -v -x /tmp/passenger.15264' \
-x /tmp/.X11-unix -x /tmp/.XIM-unix -x /tmp/.font-unix \
-x /tmp/.ICE-unix -x /tmp/.Test-unix 240 /tmp
/usr/sbin/tmpwatch: invalid option --
tmpwatch 2.9.7 - (c) 1997-2006 Red Hat, Inc. All rights reserved.
This program may be freely redistributed under the terms of the
GNU General Public License.
I think I need to feed $flags into the command in a different way...
Larry