10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi there,
A bit new to bash and am having an issue with a for loop. I look for filenames in a specified directory and pull the date string from each meeting a certain criteria, and then would like to make a directory for each date found, like this:
search 20180101.gz 20180102.gz 20180103.gz... (5 Replies)
Discussion started by: mwheeler12
5 Replies
2. Shell Programming and Scripting
Here's my code:
awk -F '' 'NR==FNR {
if (/time/ && $5>10)
A=$2" "$3":"$4":"($5-01)
else if (/time/ && $5<01)
A=$2" "$3":"$4-01":"(59-$5)
else if (/time/ && $5<=10)
A=$2" "$3":"$4":0"($5-01)
else if (/close/) {
B=0
n1=n2;
... (2 Replies)
Discussion started by: klane
2 Replies
3. Shell Programming and Scripting
Hello All,
Maybe I'm Missing something here but I have NOOO idea what the heck is going on with this....?
I have a Variable that contains a PATTERN of what I'm considering "Illegal Characters". So what I'm doing is looping
through a string containing some of these "Illegal Characters". Now... (5 Replies)
Discussion started by: mrm5102
5 Replies
4. UNIX for Dummies Questions & Answers
Hi frieds, I don't understand the difference between single square bracket and double square brackets in a IF condition.
Ex.
if ;
then
RETURNJOB=1
else
RETURNJOB=0
fi
It run, but this
if ];
then
RETURNJOB=1
else
RETURNJOB=0
fi (4 Replies)
Discussion started by: dogshort
4 Replies
5. Shell Programming and Scripting
Hi All,
I am trying to run a do while for an array. And in the do while, I'm trying to get a user response. Depending on the the answer, I go ahead and do something or I move on to next element in the array.
So far I can read the array, but I can't get the if statement to work. Any suggestions... (5 Replies)
Discussion started by: nitin
5 Replies
6. Shell Programming and Scripting
Hi,
I just came across an interesting shell script syntax like the one below:
] && (trap 'rm -rf ${WORK_DIR}/*.$$; echo "\n\nInterrupted !!\n\n"; exit 4' 1 2 3 15)
Can someone please explain the code snippet above?
The trap command bit is fine but ] && is the hazy part.
Generally we use an... (2 Replies)
Discussion started by: King Nothing
2 Replies
7. Shell Programming and Scripting
Hi
First apologies if this has been raised before.
I've got the following in a ksh script:
if ]
For some reason this does not work. But if I remove the double square brackets to:
if
This works.
I thought ksh supported the ]. Or is there more to it?
Thanks in advance. (3 Replies)
Discussion started by: tsu3000
3 Replies
8. Shell Programming and Scripting
One of the senior administrators gave me a shell script to modify and it begins as follows:
if ] && ]
{more code follows}
Why the double square brackets? (10 Replies)
Discussion started by: mojoman
10 Replies
9. UNIX for Dummies Questions & Answers
hi, unix gurus.
i am wondering if someone can give me a clear explanation of the differneces between parentheses and brackets, both single and double.
i have heard that double parentheses (( are used for numerical expressions and that single brackets [ are used for strings. but i see... (1 Reply)
Discussion started by: ankimo
1 Replies
10. UNIX for Dummies Questions & Answers
what is the rationale behind putting double square brackets in an if clause?
for e.g.
if ] || ] || ];
then
echo some fields are null
fi (5 Replies)
Discussion started by: napolayan
5 Replies