Script doesn't work, but commands inside work


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Script doesn't work, but commands inside work
# 1  
Old 11-14-2006
Power Script doesn't work, but commands inside work

Howdie everyone...

I have a shell script RemoveFiles.sh
Inside this file, it only has two commands as below:
rm -f ../../reportToday/temp/*
rm -f ../../report/*

My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it showed [Done]
But in the same directory that I executed the SCRIPT, I tried to execute the COMMANDs by themselves. They work!!! All files are removed accordingly.

Hopefully someone can help with this problem.

Many thanks in advance
# 2  
Old 11-14-2006
Quote:
Originally Posted by cheongww
Howdie everyone...

I have a shell script RemoveFiles.sh
Inside this file, it only has two commands as below:
rm -f ../../reportToday/temp/*
rm -f ../../report/*

My problem is that when i execute this script, nothing happened. Files remained unremoved. I don't see any error message as it showed [Done]
But in the same directory that I executed the SCRIPT, I tried to execute the COMMANDs by themselves. They work!!! All files are removed accordingly.

Hopefully someone can help with this problem.

Many thanks in advance
In which directory did you execute this script ? The problem could be the relative path construct ../..
# 3  
Old 11-14-2006
MySQL Thank You!!!

Smilie Thanks vino. I replaced the relative path with absolute path and it works!!!
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Saltstack commands inside bash scripts donā€™t work

In a Redhat Linux environment, I could run salt commands on the $ prompt but not inside my bash scripts. It will say command not found and the $PATH variable is exactly the same outside and inside the script. !#/usr/bin/bash echo “running”¯ salt "*" cmd.run ‘ls' exit Output:-... (8 Replies)
Discussion started by: gurudewa
8 Replies

2. Shell Programming and Scripting

Switching user inside a shell script doesn't seem to work

Linux version : Oracle Linux 6.4 Shell : Bash The following script will be run as root. During the execution, it should switch to oracle user and execute few commands. After googling and searching within unix.com , I came up with the following syntax ## Enclosing all commands in double... (7 Replies)
Discussion started by: John K
7 Replies

3. Shell Programming and Scripting

[Solved] Script doesn't work..help?

hi, i am trying to run this script.the name of script is final.sh after i run it: #./final.sh & i grep the command # ps -a | grep bash and i see more then one processes runing 3!! Please use code tags how can i solve this problem? my target script must always run in... (8 Replies)
Discussion started by: zigizag
8 Replies

4. UNIX for Advanced & Expert Users

find -exec with 2 commands doesn't work (error incomplete staement)

Hi Gurues, I need to modify an existing script that uses find to search a folder, and then move its contents to a folder. What I need to do is run gzip on each file after it's moved. So, I ran this little test: Put a ls.tar file on my $HOME, mkdir tmp, and then: virtuo@tnpmprd01: find .... (3 Replies)
Discussion started by: llagos
3 Replies

5. Shell Programming and Scripting

Perl variables inside Net::Telnet::Cisco Module doesn't work

I am writing perl script to configure Cisco device but Variables inside Net::Telnet::Cisco Module doesn't work and passed to device without resolving. Please advise. here is a sample of script: use Net::Telnet::Cisco; $device = "10.14.199.1"; ($o1, $o2, $o3, $o4) = split(/\./,$device);... (5 Replies)
Discussion started by: ahmed_zaher
5 Replies

6. Shell Programming and Scripting

my script doesn't work :(

i have this script and when i ejecute it, the console tell me this " sintax error line 41 unexpected element "}" " is the sintaxis ok? #!/bin/bash if ;then { exit 0; } if ; then { sudo /etc/init.d/apache2 start; sudo /etc/init.d/mysql start; php5 & nautilus... (3 Replies)
Discussion started by: keiserx
3 Replies

7. Shell Programming and Scripting

two grep in one script doesn't work?

Hi there, the following script doesn't work. the first part works, then the second 'grep' fails with ': not found'. However, if I take out the second part (starting with the grep command) and put in a seperate script, it works. everyone know what's wrong here? no two 'grep' in one script, that... (2 Replies)
Discussion started by: monkey77
2 Replies

8. Shell Programming and Scripting

Help with script.. it Just doesn't work

Hello,, Im verry new to scripting and have some problems with this script i made.. What it does: It checks a directory for a new directory and then issues a couple of commands. checks sfv - not doing right now checks rar - it checks if theres a rar file and when there is it skips to... (1 Reply)
Discussion started by: atmosroll
1 Replies

9. Shell Programming and Scripting

gcd.sh script doesn't work...

Hi there. I'm new to scripting in bash shell and I have this problem. I'm trying to make a script that returns the greatest common divisor of two integer numbers according to Euclid's algorithm... Here is, what I've done: #!/bin/bash m=$1 n=$2 while do if ; #line 8 then m=$m-$n... (1 Reply)
Discussion started by: kantze
1 Replies

10. Shell Programming and Scripting

script doesn't work in another distribution

Hi everybody: I usually use Mandriva distro (in my laptop), and I have made some scripts. These scripts work correctly but now, in other computer which is installed Ubuntu don't work, and I have this error message: The script is: ..... echo "Your option is:" echo read option case... (1 Reply)
Discussion started by: tonet
1 Replies
Login or Register to Ask a Question