Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am going to put this out there first, this is my shell script homework. However, I am finished with my work. It is just not running properly for some reason. I already asked 2 game developer graduates and a few peers and no one could figure out why is this not working! What is wrong?

Multiple lines without semi-colon

-bash-3.2$ chmod u+x names
-bash-3.2$ cat names
grep 94112 famous.dat | cut -c6-19 > famous.last3
grep 94112 famous.dat | cut -c21-35 > famous.first3
paste famous.first3 famous.last3
rm famous.first3
rm famous.last3
-bash-3.2$ names
paste: famous.first3 : Cannot open the file.
-bash-3.2$

Semi-colon with everything in one line

-bash-3.2$ cat names 
grep 94112 famous.dat | cut -c6-19 > famous.last3; grep 94112 famous.dat | cut -c21-35 > famous.first3; paste famous.first3 famous.last3; rm famous.first3; rm famous.last3;
-bash-3.2$ names
nina            simone        
bob             marley        
michael         franti        
keith           richards      
: command not found
-bash-3.2$

Semi-color with multiple lines

-bash-3.2$ cat names
grep 94112 famous.dat | cut -c6-19 > famous.last3; 
grep 94112 famous.dat | cut -c21-35 > famous.first3; 
paste famous.first3 famous.last3; 
rm famous.first3; 
rm famous.last3;
-bash-3.2$ names
: command not found
: command not found
nina            simone        
bob             marley        
michael         franti        
keith           richards      
: command not found
: command not found
: command not found
-bash-3.2$

Attempt to use dos2unix:

-bash-3.2$ dos2unix names namesunix
-bash: dos2unix: command not found
share|improve this question

closed as off topic by John Gardeniers, Dennis Williamson, Ward, splattne Oct 6 '10 at 6:35

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
what operating system? –  JT.WK Oct 6 '10 at 3:28
    
No idea, how can I check? –  Doug Oct 6 '10 at 3:32
    
obvious finger pointing at "." in PATH, poke poke –  Hubert Kario Oct 6 '10 at 3:39
    
You haven't told us what you think it's supposed to do, so how can anyone be expected to tell you where you've gone wrong? If you don't even know which OS you're running this on you really need to go back to basics, because that's the very first thing you should have found out. You also get a -1 for the arrogant title. –  John Gardeniers Oct 6 '10 at 4:18
add comment

1 Answer

Line endings. Try dos2unix.

share|improve this answer
    
-bash-3.2$ dos2unix names namesunix -bash: dos2unix: command not found –  Doug Oct 6 '10 at 3:20
    
pico or nano will re-save with proper linebreaks as well. –  Warner Oct 6 '10 at 4:34
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.