I do not claim to be an expert, but I have done things with scripts that whole teams of folks have said can not be done. Of course they should have said we do not have the intestinal fortitude to git-r-done.
I have been using UNIX actually HPUX since 1992. Unfortunately my old computer died and the proprietary software that I was using can not be used on Win 7. I downloaded cygdrive so that I could continue to run several awk and sed scripts I have written. These worked fine in my old Bourne shell (sh)
1st Question/comment. I have seen that #!/bin/bash must be the first line of a script. I see this as a comment not a command. Seems to me that there is confusion either on my part or the rest of the world.
The previous permissions on my script were lost probably due to windows.
I changed my script "trans_xy" to full permissions
"trans_xy"
#!/bin/bash # I think this command is BS > debug effort
# Process XY data
echo Process XY data
#cp 60-121130-01r2_ipc.net ipc # debug attempt ipc exist
sed s/" -"/" DOT."/ ipc > raw
awk '$2~/MTG/{print $0}' ipc > mtg
awk '$2~/TP/{print $0}' ipc > tp
awk '$3~/DOT/{print $0}' raw > raw1
awk '$2~/VIA/{print $0}' raw1 > vias
awk '$2!~/VIA/{print $0}' raw1 > raw_xy
sed s/"R180"/" R180"/g raw_xy > raw_xy_1
sed s/"R270"/" R270"/g raw_xy_1 > raw_xy_2
chmod 777 trans_xy
ls -l
trans_xy -rwxrwxrwx
the result copied from the bash window intresting font from the stdout
$ ./trans_xy
Process XY data
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory
: No such file or directory_1
: No such file or directory_2
If I paste the commands into bash they work like a champ.
I suspect that bash does not know to do it's work in the pwd it seems odd that the output file is referenced in the crude error message displayed on the stdout.
Notice that the error message is screwed up
command from script
sed s/"R180"/" R180"/g raw_xy > raw_xy_1
result
: No such file or directory_1
command from script
sed s/"R270"/" R270"/g raw_xy_1 > raw_xy_2
result
: No such file or directory_2
Does anyone know if what the heck is happening here?