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 the next command. when there isnt it will rar the files in the directory and create an sfv file. [commented becuase doenst work]
checks par - it checks for par2 files and when there are no pars it will create them.
post to usenet
My problem:
When i uncomment the rarring part it will rar a directory with files in it.. But when the directory has subdirectorys with rars it also rars the directory and files instead of skipping.
The script works without the rar part but i need it to rar unpacked files..
It looks like the grep part doenst work if there are subdirectorys.. I hope someone here can make this script work..
We need to get certain quirks out of the script first to make it understandable.
1) Please remove the semi-colon at the end of any line where it is the last character. This is unix script not Oracle.
2) I am nervous about the line spacing as posted. Was this script created as a unix text file using a unix text editor?
If you do this command does every line end in a $ character (meaning standard unix line terminator)?
3) Tip: If you have called a script with variables, save those variables in meaningfully-named environment variables as soon as possible in case a subsequent command changes those $n variables or the script just becomes difficult to follow. In this script we have no ideas what is in $1 except that it is a directory name and that if it is not provided we can proceed with the script after displaying a meaningless message.
Quote:
if [ "$1" == "" ]; then
echo -ne ""
Perhaps better?
4) Please re-test after removing extraneous semi-colons and removing any extraneous carriage-return characters from the script file (if present). Then please re-post the current version of the script showing exactly how it was called and all output produced (including any error messages).
5) Each time you issue an "ls" where the files may not be present, you need to stop the command failing by redirecting the error channel.
Quote:
result=$(ls -al "$path" |egrep '.*\.sfv')
6) Within the commented-out "rar" section, this line is strange:
Quote:
# if [ "$files" == "" ]; then
What do you want the test to achieve?
Last edited by methyl; 02-23-2010 at 08:49 PM..
Reason: ls quirks
I am trying to run a script to make a simple modification to a number of similar files. The sed works, but after it runs and the differences are displayed, the script does not read ans to start a renaming script if the user answered Y or y.for i in "$@"
do
sed -f myfile.sed $i >$i.new
diff... (2 Replies)
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)
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)
I have a script that only works if I remove it from the looping scenario.
#!/bin/bash
# Set the field seperator to a newline
##IFS="
##"
# Loop through the file
##for line in `cat nlist.txt`;do
# put the line into a variable.
##dbuser=$line
echo "copying plugin..."
... (6 Replies)
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)
Hi All,
Using Expect script when I run it manually it works. But when I put the entry in crontab, the job is still running after 15 hours. The script was created as root. I don't think it's a permission issue. Any idea?
This is what I have under root crontab...
00 18 * * 1-5... (4 Replies)
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)
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)
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... (2 Replies)
Hello,
I'm stuck and confused as to why when I execute things form the command line it works but when in a script it doesn't.
My script:
### creating a lock on the console
touch /var/run/console.lock
chmod 600 /var/run/console.lock
echo "$User" >>... (2 Replies)