bash - UNIX newbie: shell script not running, command not found -


i very, new unix programming (running on macosx mountain lion via terminal). i've been learning basics bioinformatics , molecular methods course (we've had 2 classes) using perl , python data management purposes. anyway, have been tasked writing shell script take data group of files , write new file in format can read specific program (migrate-n).

i have gotten number of functions need independently when type them command line, when put them in script , try run error. here details (i apologize length):

#! /bin/bash  grep -f samples.nfcup.txt locus1.fasta > locus1.nfcup.txt grep -f samples.nfcup.txt locus2.fasta > locus2.nfcup.txt grep -f samples.nfcup.txt locus3.fasta > locus3.nfcup.txt grep -f samples.nfcup.txt locus4.fasta > locus4.nfcup.txt grep -f samples.nfcup.txt locus5.fasta > locus5.nfcup.txt grep -f samples.salmon.txt locus1.fasta > locus1.salmon.txt grep -f samples.salmon.txt locus2.fasta > locus2.salmon.txt grep -f samples.salmon.txt locus3.fasta > locus3.salmon.txt grep -f samples.salmon.txt locus4.fasta > locus4.salmon.txt grep -f samples.salmon.txt locus5.fasta > locus5.salmon.txt grep -f samples.cascades.txt locus1.fasta > locus1.cascades.txt grep -f samples.cascades.txt locus2.fasta > locus2.cascades.txt grep -f samples.cascades.txt locus3.fasta > locus3.cascades.txt grep -f samples.cascades.txt locus4.fasta > locus4.cascades.txt grep -f samples.cascades.txt locus5.fasta > locus5.cascades.txt  echo 3 5 salex_melanopsis > smelanopsis.mig echo 656 708 847 1159 779 >> smelanopsis.mig echo 154 124 120 74 126 nfcup >> smelanopsis.mig cat locus1.nfcup.txt locus2.nfcup.txt locus3.nfcup.txt locus4.nfcup.txt locus5.nfcup.txt >> smelanopsis.mig echo 32 30 30 18 38 salmon river >> smelanopsis.mig cat locus1.salmon.txt locus2.salmon.txt locus3.salmon.txt locus4.salmon.txt locus5.salmon.txt >> smelanopsis.mig echo 56 52 24 29 48 cascades >> smelanopsis.mig cat locus1.cascades.txt locus2.cascades.txt locus3.cascades.txt locus4.cascades.txt locus5.cascades.txt >> smelanopsis.mig 

the series of greps pulling out dna sequence data each site each locus new text files. samples...txt files have sample id numbers site, .fasta files have sequence information organized sample id; grepping works fine in command line if run individually.

the second group of code creates actual new file need end with, ends in .mig. echo lines data counts (basepairs per locus, populations in analysis, samples per site, etc.) program needs information on. cat lines mash locus site data created grepping below site-specific information dictated in echo line. no doubt picture.

for creating shell script i've been starting in excel can copy-paste/autofill cells, saving tab-delimited text, opening text file in textwrangler remove tabs before saving .sh file (line breaks: unix (lf) , encoding: unicode (utf-8)) in same directory files used in script. i've tried using chmod +x filename.sh , chmod u+x filename.sh try make sure executable, no avail. if cut script down single grep line (with #! /bin/bash first line) can't work. process takes moment when type directly command line none of these files larger 160kb , smaller. type in , when try run file (hw correct directory)

localhost:hw mirel$ migratenshell.sh -bash: migratenshell.sh: command not found 

i've been @ impass 2 days now, input appreciated! thanks!!

for security reasons, shell not search current directory (by default) executable. have specific, , tell bash script in current directory (.):

$ ./migratenshell.sh 

Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -