Computing.Net > Forums > Unix > basic unix scripting help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

basic unix scripting help

Reply to Message Icon

Name: xmikex
Date: February 4, 2007 at 15:52:35 Pacific
OS: windowsxp
CPU/Ram: amd dual core4600+/2gig
Product: i made it
Comment:

my code:

#!/bin/sh

export PATH=$PATH:/csc4630/scripts


grep -v '<' "$1" | grep -v 'Back to' | grep - v 'Chapter' | tr " " "\n" | sort | uniq -c > moby{"$1"}lex


end of my code

that is my program, basically takes a file from the command line containing txt, and outputs it to a file, with some sorting and manipulation...

the code is syntax error free

bash$ sh -x mobylex.sh

mobylex.sh: ^M: not found
+ export PATH=/opt/gnu/bin:/home2/jdk1.5.0/bin:/bin:/usr/bin:/usr/ucb:/usr/bin/X11:/usr/local/bin:/usr/local/bin:/opt/local/bin:/usr/gnu/bin:/usr2/local/bin:/mn /local/bin:/usr/ucb:/csc4630/scripts
mobylex.sh: PATH=/opt/gnu/bin:/home2/jdk1.5.0/bin:/bin:/usr/bin:/usr/ucb:/usr/bin/X11:/usr/local/bin:/usr/local/bin:/opt/local/bin:/usr/gnu/bin:/usr2/local/bin:/mnt/local/bin:/usr/ucb:/csc4630/scripts^M: is not an identifier
bash$ sh -n mobylex.sh

im not sure what that error means, but also before i did that
i did chmod +x mobylex.sh to allow it to become executable
bash$ mobylex.sh 063
bash: mobylex.sh: command not found

anyways, any insight? this is my first time unix scripting




Sponsored Link
Ads by Google

Response Number 1
Name: thepubba1
Date: February 5, 2007 at 07:15:36 Pacific
Reply:

Having given your problem the benefit of my brillant and penetrating mind, I'd say the problem is the space between the "-" and the "v" in the second grep command.


Jerry Lemieux


0

Response Number 2
Name: xmikex
Date: February 5, 2007 at 09:23:40 Pacific
Reply:

thanks that was one minor problem, i figured out the rest


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: basic unix scripting help

Unix script help www.computing.net/answers/unix/unix-script-help/6110.html

UNIX script help please www.computing.net/answers/unix/unix-script-help-please/5517.html

UNIX..basic shell script help www.computing.net/answers/unix/unixbasic-shell-script-help/8506.html