mv command not found bug


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting mv command not found bug
# 1  
Old 08-22-2010
mv command not found bug

Code:
foreach x ( *.foo)

        echo "move file?"
        set move=$<
        if($move == y) then
         echo "enter new pathname:"
         set path=$<
         mv $x $path/$x
endif
end


ok guys, im creating this script so i can move files with *.foo extensions and *.bar extension, to a path a user enters.
but im getting this error "mv command not found"
btw, it is half-way done. only for the *.foo files
# 2  
Old 08-22-2010
Did you do anything with $PATH variable in that script?
# 3  
Old 08-22-2010
hmmm.... ok... i didn't do anything with the $PATH variable... but i used $path...
same thing huh? Smilie
# 4  
Old 08-22-2010
I think you should post your whole script. Then we might identify source of your problem.
# 5  
Old 08-22-2010
that is my whole script. anw i found the problem. i shouldn't have used the "path" as a name for a variable
# 6  
Old 08-22-2010
Quote:
Originally Posted by pantelis
that is my whole script. anw i found the problem. i shouldn't have used the "path" as a name for a variable
Can you post the complete command now?
Was that a vim script?
# 7  
Old 08-22-2010
Hi.

path is a CSH shell special variable:

Code:
       path    A  list  of  directories  in  which to look for executable commands.  A null word specifies the current
               directory.  If there is no path variable then only full path names will execute.  path is  set  by  the
               shell  at  startup from the PATH environment variable or, if PATH does not exist, to a system-dependent
               default something like `(/usr/local/bin /usr/bsd /bin /usr/bin .)'.  The shell may  put  `.'  first  or
               last  in  path or omit it entirely depending on how it was compiled; see the version shell variable.  A
               shell which is given neither the -c nor the -t option hashes the contents of the  directories  in  path
               after  reading ~/.tcshrc and each time path is reset.  If one adds a new command to a directory in path
               while the shell is active, one may need to do a rehash for the shell to find it.

You should use a different name for your variable.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Has AudioScope found a bug in bash 4.4.5?

Using AudioScope.sh on Ubuntu 17.04 from a live DVD disc I came across an error. Consider the code below it is a MUCH shortened version of the KEYBOARD input in AudioScope. #!/bin/bash bash --version uname -a status=0 KEYBOARD() { read -r -p "Enter QUIT or EXIT to quit:- " kbinput if ||... (11 Replies)
Discussion started by: wisecracker
11 Replies

2. UNIX for Beginners Questions & Answers

Command not found

On my MAC - I get Command not found error for some command like mvn , java_home etc . I CD to the actual directory to take path out of picture and even then i get the command not found error . anyone else have the same problem ? (3 Replies)
Discussion started by: ambm01
3 Replies

3. UNIX for Advanced & Expert Users

Strange bug crontab command line php / bcompiler

Hello everyone, I have a small problem that I'm stuck for several days and I do not go out. I tell you, I have a php script that I want to run crontab, it uses a compiled bcompiler file. In my php file if(file_exists("php/Alibrary.phb")){ include_once("php/Alibrary.phb"); What I do... (6 Replies)
Discussion started by: nicolas33770
6 Replies

4. Linux

Bug in date command?

Why is the result of this command off (or less) by one hour date --date "1979-10-26 +54 hours" +%Y%m%d%H The result is 1979102805 It actually should be 1979102806 It does it with adding minutes as well and only occurs on Oct. 26, from what I can tell. What's going on here? (9 Replies)
Discussion started by: hsemune
9 Replies

5. Shell Programming and Scripting

Want to terminate command execution when string found in the command output

Hi Experts, I am very much new to linux scripting, I am currently working on reducing my manual work and hence writing a script to automate few task. I am running below command to snmpwalk the router.. snmpwalk -v 3 -u WANDL_SU -a MD5 -A vfipmpls -x DES -X VfIpMpLs -l authPriv... (19 Replies)
Discussion started by: Hanumant.madane
19 Replies

6. Shell Programming and Scripting

When i am trying to execute export command within a shell script it is saying command not found.

I am running the export command within a view to use that value inside my build script. But while executing it it is saying "export command not found" My code is as follows: -------------------------- #!/bin/sh user="test" DIR="/bldtmp/"$user VIEW="test.view1" echo "TMPDIR before export... (4 Replies)
Discussion started by: dchoudhury
4 Replies

7. Shell Programming and Scripting

bash: <command nm> command not found

I created a script that I need to run from time to time, but get this error message. To get it working again I run this command from time to time: export PATH="$PATH:~/scripts" I put all my automated scripts in the /scripts directory and would like to run my scripts from any directory... (5 Replies)
Discussion started by: catalinawinemxr
5 Replies

8. Post Here to Contact Site Administrators and Moderators

Have I found a bug?

When searching for new posts, I see that my voting in one of the polls counts as a 'new post'. However, while the '<blah> minutes ago' entry updates correctly, the 'by <username>' is the last user to actually post a comment in the poll instead. Result: Poll: vB Guest Book 39... (4 Replies)
Discussion started by: Smiling Dragon
4 Replies

9. Shell Programming and Scripting

how can i check in csh if command found or not found ?

hello all im trying to use in sun Solaris the information received from the top command now i several machines that dont have install the top program so when im running the script im geting error saying after im running this code : set MemoryInfo = `top | grep Memory` if (... (2 Replies)
Discussion started by: umen
2 Replies
Login or Register to Ask a Question