LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-12-2007, 06:00 AM   #1
savoirefaire
LQ Newbie
 
Registered: Mar 2007
Posts: 2

Rep: Reputation: 0
Hi, I am a complete n00b in need of help executing her bash shell script.


I am working on my final year project in University. I am a Bio student and so no close to nothing when it comes to Linux.

I am running a simulation on a program called Amber 8 which runs on Linux. I have to run a series of fifteen shell scripts for a step (minimization) in my project and I am ages ages behind.

I managed to run my very first file a couple of weeks ago and it looks like this:

Code:
 #!/bin/bash

cd /home/sandhya/p53

cp p53bp2.restrt refc

rm -f myprocfile

LSB_HOST=1

for i in $LSB_HOST; do
  HN=`echo $i|cut -f 1 -d .`
  echo "/usr/local/amber8/exe/sander -O -i newmd.in -o md1.out -p p53bp2.parmtop -c p53bp2.restrt -r restrt1 -ref refc  -x mdcrd1 -v mdvel1 -e mden1 -inf mdinfo " >> myprocfile
done

chmod a+x myprocfile
cat myprocfile
I know it was successful as I can see both my input and output files in my directory. In my subsequent step which needs the files generated in this shell script and the addition of an input file h2.in (which I have in my directory), I modified my script in accordance to the one above, changing only filenames etc (as I was recommended to). However, I get the -bash: ./h2.sh: Permission denied
response.

My script, h2.sh looks like this:
Code:
#!/bin/bash

cd /home/sandhya/p53

cp restrt1 refc1

rm -f myprocfile

LSB_HOST=1

for i in $LSB_HOST; do
  HN=`echo $i|cut -f 1 -d .`
  echo "/usr/local/amber8/exe/sander -O -i h2.in -o md2.out -p p53bp2.parmtop -c restrt1 -r restrt2 -ref refc1  -x mdcrd2 -v mdvel2 -e mden2 -inf mdinfo1 " >> myprocfile
done

chmod a+x myprocfile
cat myprocfile
I am completely LOST at the moment but I have two questions.
a) what am I missing, doing wrong in my second script that I should be aware of and be careful of when I do the rest of my fifteen subsequent steps?
b) is the problem also in the fact that i am using "./h1.sh" as an invocation? Because i have a feeling that I may have forgotten how to run a shell script altogether (it's been two weeks since i last saw how to)?

Please please, someone help ASAP. I am very very doomed for my project. I am ready to provide more infos if any are lacking in this very desperate plea of a post.
Thanks alot. I am deeply appreciative of all those of you who can help.
 
Old 03-12-2007, 06:27 AM   #2
greengrocer
Member
 
Registered: Aug 2005
Distribution: Ubuntu Intrepid and Meerkat, formerly used Debian 3.1 (Sarge) with Gnome Desktop
Posts: 353

Rep: Reputation: 37
Hi savioufaire,

I never went to University but I think I can help with your problem.

Ok, your using "born again shell", so you should be able to execute your shell scripts with the sh command, for example:

Code:
sh <filename>

Hope that helps,
Regards,
Greenie
 
Old 03-12-2007, 06:39 AM   #3
savoirefaire
LQ Newbie
 
Registered: Mar 2007
Posts: 2

Original Poster
Rep: Reputation: 0
Hello!

I did as you mentioned and while i got this
Code:
sandhya@sbscluster p53 $ sh h2.sh
/usr/local/amber8/exe/sander -O -i h2.in -o md2.out -p p53bp2.parmtop -c restrt1 -r restrt2 -ref refc1  -x mdcrd2 -v mdvel2 -e mden2 -inf mdinfo1
BUT upon checking my directory, I do not see any of the output files, md2.out for example.

 
Old 03-12-2007, 07:06 AM   #4
greengrocer
Member
 
Registered: Aug 2005
Distribution: Ubuntu Intrepid and Meerkat, formerly used Debian 3.1 (Sarge) with Gnome Desktop
Posts: 353

Rep: Reputation: 37
Hi,

Well I wondered about your script, because I thought why would you want to create a file called "myprocfile" that contains only the content of this line:

Code:
/usr/local/amber8/exe/sander -O -i h2.in -o md2.out -p p53bp2.parmtop -c restrt1 -r restrt2 -ref refc1  -x mdcrd2 -v mdvel2 -e mden2 -inf mdinfo1

Do you think that the echo command in your script should be removed?

Perhaps make a backup folder first, called "projectbackup";

Code:
mkdir /usr/local/amber8/exe/projectbackup
then change directory to where your files are (using the 'cd' command;

and then copy all of your files to your projectbackup folder;

Code:
cp * /usr/local/amber8/exe/projectbackup
now remove the echo command from this line in your script;

Code:
  echo "/usr/local/amber8/exe/sander -O -i h2.in -o md2.out -p p53bp2.parmtop -c restrt1 -r restrt2 -ref refc1  -x mdcrd2 -v mdvel2 -e mden2 -inf mdinfo1 " >> myprocfile
so that the line looks like this;

Code:
  /usr/local/amber8/exe/sander -O -i h2.in -o md2.out -p p53bp2.parmtop -c restrt1 -r restrt2 -ref refc1  -x mdcrd2 -v mdvel2 -e mden2 -inf mdinfo1 >> myprocfile
and then run the script again.

Regards,
Greenie

Last edited by greengrocer; 03-12-2007 at 07:13 AM.
 
Old 03-12-2007, 07:14 AM   #5
bigrigdriver
LQ Addict
 
Registered: Jul 2002
Location: East Centra Illinois, USA
Distribution: Debian stable
Posts: 5,877

Rep: Reputation: 350Reputation: 350Reputation: 350Reputation: 350
I don't know anything about Amber8, but I'll take a stab at it.

After running the first script, run 'ls -l' on the directory containing the created file. Who is the owner? If Amber8 owns the file, your chmod command won't change the execute permission, and the next script will fail with a 'permission denied' message.

Your first script will have to change ownership (chown <username> <filename>) before the chmod command will work. Then the second script may work.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
executing konsole from shell script Meriadoc Linux - Newbie 10 07-10-2009 09:08 AM
Bash script - executing a script through subdirectories bubkus_jones Programming 5 04-24-2006 06:05 PM
Executing a shell script command!! vishamr2000 Programming 4 08-15-2005 01:33 AM
executing shell script on apache nooodles Linux - General 1 06-29-2004 02:51 AM
executing a shell script from C llama_meme Programming 2 04-01-2002 10:10 PM


All times are GMT -5. The time now is 04:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration