10-24-2012
I find a vi search for [('"] allows me to verify the closing parens with % and count the quotes in and out. Figureing if the ) is in a different quoting space can be a problem. Good structural indentation helps identify quoted areas. Note that case statements can have wild card starting with ( so they do not confuse %, although case traditionally did not use them. If you have isolated () in character or string contexts, you can temporarily replace them with substitute strings like '~oparens' and '~cparens'. (The ~ is the rarest ascii visible glyph.)
You cannot blame tcsh or bash for the fact that exec() obeys the magic line. It is nice that you can ensure your scripts use the designed interpreter. If you source a file or feed the file to stdin, the magic is ignored (no exec()). You are even allowed one argument on the magic line, so you can say things like "#!/bin/awk -f" or "#!/bin/sed -f" and make scripts for tools not normally considered script interpreters. It saves a fork() and exec() over a shell script calling awk or sed.
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
when I execute the below script, I am getting following error "Badly placed ()'s". can anyone please help me fix
----------------------------------------------------------
# Usage: ani -n -a -s -w -d
#
#
# help_ani() To print help
#
help_ani()
{
echo "Usage: $0 -n -a -s -w -d"... (3 Replies)
Discussion started by: amitrajvarma
3 Replies
2. Shell Programming and Scripting
Hi,
I am doing the following but it complains and says "for:badly formed number"
does anyone know why?
#!/bin/tcsh
foreach(....)
............
set depth=64
set width=23
if ($depth==64) then
echo "if"
set addr_bits=5
else
echo "else"
endif
echo "addr_bits:$addr_bits"
echo... (3 Replies)
Discussion started by: ROOZ
3 Replies
3. Shell Programming and Scripting
how can I delete one line above and below the matching pattern ?
e.g I want to delete the line above and below the line with %CLI- in example below :
$CHECKSUM $1$DGA1043:TSTST01.DBF;1
%CLI-E-OPENIN, error opening $1$DGA1043:TSTST01.DBF
-RMS-E-FLK, file currently locked by another user
... (6 Replies)
Discussion started by: aliyesami
6 Replies
4. Shell Programming and Scripting
I have the following script running every day numerous times a day and it works fine, but very occasionally I get the following error
if: Badly formed number.
Anyone know why?
Here is the script that runs with the follow parms
LCTMDBSE 100000 130000 160000
#!/bin/csh
... (0 Replies)
Discussion started by: Northerner
0 Replies
5. UNIX for Dummies Questions & Answers
I have this file:
NPANXX|BILLDATE|DIVCODE|COMID|RAO|LIKECODE|BOSS|SORD|STATECODE|
087001|BP01|H|SWBT| |041|IMR6|IMSR6|AR|
087002|BP03|H|SWBT| |042|IMR6|IMSR6|AR|
087003|BP05|H|SWBT| |043|IMR6|IMSR6|AR|
....
these are the things that i HAve to do:
Insert a new column named “TEST”
All... (14 Replies)
Discussion started by: arkhei
14 Replies
6. Shell Programming and Scripting
i'm trying to run the following program but i keep getting the message "badly placed ()'s" can u help?
#include "modularity_mat.h"
#include "../sparse_mlpl/sparse_matrix.h"
adj_matrix_arr* allocate_mem_for_matrix_arr (int y) {
/* Create the adj matrix and allocate memory */
... (2 Replies)
Discussion started by: ronirosner
2 Replies
7. Shell Programming and Scripting
The terminal is bash.
Whenever I try to execute csh just by itself it gives Badly Placed ()'s.
Whenever I try to use csh with a script it also gives Badly Placed ()'s.
My script is this, there is nothing wrong with it, since it used by other students in class as well. (I have also asked... (5 Replies)
Discussion started by: quantumizer
5 Replies
8. Programming
I dont know why this Linux would give me badly placed () error all the time for this;
#include <stdio.h>
int main()
{
register int num=0 ;
while ((num < 5))
++num;
printf("Pass %d \n", num) ;
return 0 ;
}
can anyone help me please? (11 Replies)
Discussion started by: sizzler786
11 Replies
9. Shell Programming and Scripting
Edit - I don't know how to delete posts. The question I asked here ended up not being the question I should have asked as I didn't realise I needed to edit my script to comply with SGE.
Hi,
My script is:
#!/bin/bash
# Perform fastqc on files in a specified directory.
for ((j=1;... (8 Replies)
Discussion started by: una1992
8 Replies