The UNIX and Linux Forums  
Hello and Welcome from to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #7 (permalink)  
Old 10-13-2008
llsmr777 llsmr777 is offline
Registered User
  
 

Join Date: May 2007
Posts: 58
Oh I'm sorry. I'm obviously clueless I know that!

here is my code

Code:
for i in `ls -1 | grep $1 | grep  $2`
do
x=`echo $i | sed 's/\.Sent/\.Done/g'`
echo mv $i DONE/$x
done
echo "Is this OK?"
read user_response

case $user_response in

"y"|"Y")
        mv $i DONE/$x
        echo moved $i to DONE/$x;;
*)
        echo "No changes made ...";;

esac

Code:
for i in `ls -1 | grep $1 | grep  $2`
do
x=`echo $i | sed 's/\.Sent/\.Done/g'`
echo mv $i DONE/$x
done
Here i am compliing my list that I want to rename from .Sent to .Done
And then outputing it to the screen

Code:
echo "Is this OK?"
read user_response
Here I ask if what outputed was what the user wants to move


Code:
case $user_response in

"y"|"Y")

        for i in `ls -1 | grep $1 | grep  $2`
        do
        x=`echo $i | sed 's/\.Sent/\.Done/g'`
        mv $i DONE/$x;;
*)
        echo "No changes made ...";;

esac
Here I want the files to be moved from .Sent to .Done and then if the user says Y
and to print to screen "No changes made" if the user says no

When I run the script it lists all the files
then asks me if it's ok
when I hit Y
And I do a listing only 1 of the files listed were moved not all.

Thanks again.

Last edited by llsmr777; 10-13-2008 at 05:47 PM..