![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| gcd.sh script doesn't work... | kantze | Shell Programming and Scripting | 1 | 01-17-2008 09:46 PM |
| Modify Perl script to work with txt - Permissions script | joangopan | Shell Programming and Scripting | 1 | 09-13-2007 12:38 AM |
| My script does not work - could you pls help? | BearCheese | Shell Programming and Scripting | 1 | 06-29-2007 06:12 AM |
| Script doesn't work, but commands inside work | cheongww | UNIX for Dummies Questions & Answers | 2 | 11-14-2006 10:52 PM |
| sed script. How does it work? | billy5 | Shell Programming and Scripting | 2 | 09-02-2005 05:45 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
I put the done after I get my listing instead of the end of the script.
Can I put my mv statement inside my Case Statement? You asked me "how are you using it? We're not mind readers" to my comment "I am using it to ask the user if the list is correct" Not sure what you are asking me? I want my case statement to ask the user if the list (mv commands plus name of files) outputed to the screen is the files that they want renamed and then moved. I hope that answers that questions correctly. And yes I meant that the case does carry out what is to happen if the user says yes or no. Yes- rename file from .Sent to .Done and then move to a subdirectly called DONE No - just output to the screen "no changes made..." I did change the for string to what you suggested. I will change: x=`echo $i | sed 's/\.Sent/\.Done/g'` TO: x=${i%%.Sent*}.Done${i#*.Sent} But can you explain this syntax to me? I want to understand it before I just change it. AGain I appreciate all your help and patience. |
|
|||||
|
Quote:
Quote:
Quote:
Quote:
Quote:
|
|
||||
|
Ok here is what I changed it to. I haven't tested it because I wanted input first. Code:
function build_list
{
for i in *$1*$2*
do
x=`echo $i | sed 's/\.Sent/\.Done/g'`
done
}
function show_list
{
echo mv $i DONE/$x
}
echo "Is this Ok?"
read user_response
if [$user_response="y"|"Y"]
then
mv $i DONE/$x;;
else
if [$user_response="n"|"N"]
then
echo "No changes made ...";;
fi
fi
|
|
||||
|
You need to have a loop that prints the list then waits for the input of "Y|y"... if it is yes then have another loop that actually moves the file...
I would have a loop that prints the files and if it is "yes" then in the if statement have another loop that moves the files... (same loop but remove the "echo")... |
|
||||||
|
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|