Newbie wanting help with a script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Newbie wanting help with a script
# 1  
Old 09-18-2011
Newbie wanting help with a script

Hi

I am new to scripting and having trouble with an assignment. I have written this script:

Code:
#!/bin/bash

PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin

printf "\nWhat is the name of the input file?  "
read INPUT_FILE

if test ! -f ./$INPUT_FILE ; then
  printf "\nNo matching file name!!!  Aborting!!!\n\n"
  exit 192
fi

clustalw -align -INFILE=$INPUT_FILE -TYPE=DNA -OUTFILE=$INPUT_FILE_clustal.output -OUTPUT=PHYLIP

collapse1.5 $INPUT_FILE_clustal.output > $INPUT_FILE_collapse.output

seqret  -nofeature -sequence $INPUT_FILE_collapse.output -sformat1 phylip -snucleotide1 -nofirstonly -outseq $INPUT_FILE.nexus -osformat nexusnon -auto

rm -f *.output


But I get this error message in the terminal:


Code:
Foyn@Havard-Foyns-MacBook-Air:~/Desktop/Foyn_Miniproject_2_Part_1$ Miniproject_2_script 

What is the name of the input file?  Part_2_Seq.fasta
/Users/Foyn/UNIX_progs/bin/Miniproject_2_script: line 20: clustalw: command not found
/Users/Foyn/UNIX_progs/bin/Miniproject_2_script: line 24: collapse1.5: command not found
/Users/Foyn/UNIX_progs/bin/Miniproject_2_script: line 28: seqret: command not found


When I run the individual commands in the terminal on the other hand it seems to be working.

Is there anyone that knows what the problem is??

Last edited by pludi; 09-18-2011 at 06:41 PM..
# 2  
Old 09-18-2011
It is your PATH variable...why dont you copy the PATH from the terminal into the script instead of initializing it to dirs that dont contain those commands...clustal seqret collapse1.5
This User Gave Thanks to shamrock For This Post:
# 3  
Old 09-18-2011
Thank you. Have done that now and the first part is now working (clustalw), but now I get the following error:


PHYLIP-Alignment file created [.output]


ERROR: the input file does not seem to be a valid Phylip file
collapse1.5(1635) malloc: *** mmap(size=140737488355328) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug


Seems like the output file is not named correctly so collapse1.5 don't find the input. Is there something wrong with my INPUT_FILE variable?

---------- Post updated at 09:11 PM ---------- Previous update was at 09:07 PM ----------

Fixed it
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script newbie, what is problem with my script?

Hello, Ubuntu server 11.10 can anybody help what is problem with my shell script? #!/bin/bash #script to find out currently logged on user is root or not. if ] then echo "You are super" else echo "You are awesome!" fi When I run script, I get following output ./uid: line 3: I... (4 Replies)
Discussion started by: kaustubh
4 Replies

2. Shell Programming and Scripting

please help newbie with script

hi!i am musician and have very little knowledge about shell here's my script #!/bin/bash for (( ; ; )) do wget some wikipedia article here --output-document=- > /dev/audio done so it downloads random wikipedia page (forum doesnt let me post link so i wrote some wikipedia article here... (6 Replies)
Discussion started by: karlhungus
6 Replies

3. UNIX for Dummies Questions & Answers

Wanting to run a macro/script from PuTTY

We currently use TUN as an emulation program to connect to various unix applications. I am looking at moving to PuTTY release 0.60 but am getting stuck as one application runs a macro at startup to run a program. My question is, can you run a macro from PuTTY? Any pointers would be great. (0 Replies)
Discussion started by: virtualpaul
0 Replies

4. Shell Programming and Scripting

Newbie needs help with ping script

Hi all, I've been trying to get this script right for the past few days and just can't figure out where I'm going wrong. Since one of my internet connections is extremely flaky I want to run this script to ping every 5 minutes and then reboot the router via telnet if I don't get a response. ... (5 Replies)
Discussion started by: goatmilk
5 Replies

5. Shell Programming and Scripting

Expect script help (newbie)

Im a UNIX newbie so please excuse the little knowledge I have, Im trying to learn. I created a script that logs into multiple servers, gets data and saves it on the local server. The script looks like this.. #!/opt/local/bin/expect # Set username/password to initially login to switch.... (4 Replies)
Discussion started by: jay11789
4 Replies

6. Shell Programming and Scripting

Shell Script Help -I'm a newbie

Can someone help me write this shell script? I am completely new to shell and as a fun task my uncle has challenged me a problem (out of all other people). Basically, all he wants me to do is to create backup file in a folder that is named “disables.” This is what he said: create a shell script... (0 Replies)
Discussion started by: hotcutiepie05
0 Replies

7. Shell Programming and Scripting

Help - shell script newbie

My problem looks like it should have a simple solution but it seems that after many days of research I cannot find a good solution. What I have is an input file that contains lines of information. What I need is to extract specific information from that file. What I know is that somewhere in the... (2 Replies)
Discussion started by: eback
2 Replies

8. Shell Programming and Scripting

Newbie needs help with simple script

Hi, I'm just new here, looks like there is alot to read. I need some help on a simple script that i would like to make, and I honestly have zero experience with shell scripts or anything, so i have no idea what I am doing. I want to have a script that I can upload to to my webhosting... (12 Replies)
Discussion started by: shizizzle
12 Replies

9. SCO

Wanting to boot from a previous kernel

I tried to add ppp on a serial line tty1b and I relink the kernel. Now, I would like to boot from the previous kernel because I lost the connexion for the others terminal (serial lines) too. I would appreciate any help. (3 Replies)
Discussion started by: pacctono
3 Replies
Login or Register to Ask a Question