Doesn't recognize the mv command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Doesn't recognize the mv command
# 1  
Old 11-14-2005
Doesn't recognize the mv command

I'm nearly finished my program i've got everything in place and than when i run it it comes back with the reply mv: command not found. This is the code that seems to be causing the problem.
elif [ $NUM -eq 2 ]
then
echo "There are more than one '$1' files in the system."
echo "Please select from the options below"
echo "1) Deleted from:$PathVar1 Deleted at $TimeVar1 on $DateVar1"
echo "2) Deleted from:$PathVar2 Deleted at $TimeVar2 on $DateVar2"
echo "3) Exit"
echo "Please enter the number of the file that you wish to restore"
read ANSWER
case $ANSWER in
1) mv $1 $PathVar1;;
2) mv $1 $PathVar2;;
3) exit;;
esac
But i can't see anything wrong with it. Why does the cpu not recognize the mv command. Has anyone else experienced this, Please let me know.
# 2  
Old 11-14-2005
Quote:
Originally Posted by zoolz
case $ANSWER in
1) mv $1 $PathVar1;;
2) mv $1 $PathVar2;;
3) exit;;
esac
Zoolz,

My guess is that there is an issue with your $ANSWER variable, unless you have specifically typecasted the $ANSWER variable, shell is going to read the variable as a string value rather than a integer value. Hence change your script as follows.

Code:
case "$ANSWER" in 
"1") mv $1 $PathVar1;;
"2") mv $1 $PathVar2;;
"3") exit;;
esac

Jerardfjay
# 3  
Old 11-14-2005
Try to maintain mv as /usr/sbin/mv and then try .

Also check the same mv command with whereis mv command.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. IP Networking

DNS problem : ping doesn't recognize hostname

I have vmware on my windows PC ( hostname : acer ). vmware has RHEL 7 ( hostname : rhel7 ) installed recently. RHEL IP configuration IP : 192.168.5.128 Netmask : 255.255.255.0 ssh to rhel7 works from acer using putty resolve.conf cat /etc/resolv.conf nameserver 192.168.5.1 host... (12 Replies)
Discussion started by: hiten.r.chauhan
12 Replies

2. Shell Programming and Scripting

Value of variable is NULL, but test doesn't seem to recognize

Hello, Unix-forums! My problem: read -p "Enter any number, please" number sleep 1 echo $number | tr -d 0-9 test -z $number && echo "Thank you" || echo "This is not a number"Test always displays "This is not a number". It doesn't matter if I entered a or 1. But if I order echo... (2 Replies)
Discussion started by: intelinside
2 Replies

3. Shell Programming and Scripting

Expect doesn't recognize a password prompt

Hi. Here is beginning of my script #!/usr/local/bin/expect -- set timeout 15 spawn /usr/local/account.sh -n modify expect "Password:" {send "mypassword\r"} But due to some terminal control sequences (or something else, dunno exactly) my password prompt is looking like this: and expect... (3 Replies)
Discussion started by: urello
3 Replies

4. IP Networking

ping can not recognize host but host command can

Hi, I have a weird problem. when ever I do ping command like for example ping unix.comI get the following message: # ping unix.com ping: unknown host unix.com but when I use host the computer is able to know the host. # host unix.com unix.com has address 81.17.242.186 unix.com mail is... (2 Replies)
Discussion started by: programAngel
2 Replies

5. Shell Programming and Scripting

Command doesn't execute

Hi All. Little mystery here. I've been teaching myself perl, and I want to execute regular linux / unix commands i.e. cd .. , cd /etc and have been using the command(s) execute ("cd .."); or system ("cd .."); I don't get any error messages, even when I do a debug, but for some reason... (5 Replies)
Discussion started by: azrael2000
5 Replies

6. Homework & Coursework Questions

Command Doesn't Show Description

im making c code in linux and im having problems with one command, id should bring up a list but instead id doesnt do nothing, there are no error's, can anyone solve whats wrong ? void environ() { extern char **environ; int i=0; for (i = 0; environ !=NULL;i++) { ... (1 Reply)
Discussion started by: figureout
1 Replies

7. Shell Programming and Scripting

crontab doesn't allow `command` ??

Dear All, We wrote a script to clean email mailbox when they're nearly full and put it in cron : 0 0 * * * /root/quota/autoclean.sh > /root/quota/autoclean.`date '+%Y%m%d'` 2>&1 I've run this command from command prompt, it did work. However, if running from cron, it returned such error... (1 Reply)
Discussion started by: tiger2000
1 Replies

8. HP-UX

HP-UX 11.11: X doesn't recognize mouse and keyboard

hi folks, i've got a blank hp visualize C3000 workstation and installed HP-UX 11.11. When I want to start X, I get the following error message: # X Fatal server error: Couldn't open X pointer device! Is one attached? I've connected an mouse and a keyboard with an usb/ps2 connector.... (5 Replies)
Discussion started by: grisu
5 Replies

9. Shell Programming and Scripting

Command doesn't work under cron ?

I have defined in cron crontab -l >/FIXENGINE/data/crontab.$(whoami).$(date +%a) The resulting file is named crontab.fixadmin. When I run the above from a command line, the file is named: crontab.fixadmin.Tue (or whatever day I happen to be running) The question is - why do I get... (4 Replies)
Discussion started by: bigjohn-nj
4 Replies
Login or Register to Ask a Question