Re: [SLE] (Bash scripting)setting variables from the shell
I want to do this (dont give me other ways of doing this
since I want to make an abstract to apply in other situations)
# locate netscape (pipe) grep xpm (pipe) cp stdout /opt/kde/share/icons
Now how do I assign:
"locate netscape (pipe) grep xpm"
to be variable $1 and then how do I manage to make cp copy $1 ?
What about more than a variable?
Thanks!
Raul
-- To unsubscribe send e-mail to suse-linux-e- unsubscribe@suse.com For additional commands send e-mail to suse-linux-e- help@suse.com Also check the FAQ at http://www.suse.com/support/faq and
specific task the
archives at http://lists.suse.com
Hi Paul,
You could try the following:
for fname in $(locate netscape | grep xpm); do
cp $fname /opt/kde/share/icons
done
HTH,
Thomas Adam
-----------
Thomas Adam
-----------
"The Linux Weekend Mechanic" --
Try this: #! /usr/bin/sh LOCATE=`which locate` GREP=`which grep` CP=`which cp` # Destination path to copy destination="/opt/kde/share/icons" # command to find. MYFILE=$1 | netscape # Your filter. MYFILTER=$2 | xpm # Run the search and copy. $LOCATE $MYFILE | $GREP $MYFILTER | while read fileToCopy do if [ -f $fileToCopy ]; then printf "copying file: %s\n" `basename $fileToCopy` $COPY -f $fileToCopy $destination else printf "%s is not a valid file\n" `basename $fileToCopy` fi done exit 0 ---- cut here --- Hope this helps -William At 09:40 AM 12/3/2001 +0000, you wrote:
I want to do this (dont give me other ways of doing this
since I want to make an abstract to apply in other situations)
# locate netscape (pipe) grep xpm (pipe) cp stdout /opt/kde/share/icons
Now how do I assign:
"locate netscape (pipe) grep xpm"
to be variable $1 and then how do I manage to make cp copy $1 ?
What about more than a variable?
Thanks!
Raul
-- To unsubscribe send e-mail to suse-linux-e- unsubscribe@suse.com For additional commands send e-mail to suse-linux-e- help@suse.com Also check the FAQ at http://www.suse.com/support/faq and
specific task the
archives at http://lists.suse.com
Hi Paul,
You could try the following:
for fname in $(locate netscape | grep xpm); do cp $fname /opt/kde/share/icons done
HTH,
Thomas Adam
----------- Thomas Adam ----------- "The Linux Weekend Mechanic" --
"This is Linux country. If you listen carefully you can hear the sound of Windows rebooting....."
-- To unsubscribe send e-mail to suse-linux-e-unsubscribe@suse.com For additional commands send e-mail to suse-linux-e-help@suse.com Also check the FAQ at http://www.suse.com/support/faq and the archives at http://lists.suse.com
William P. Dulyea _______________ Phone: 651-5206 Office: L-423
participants (2)
-
THOMAS ADAM
-
William Dulyea