The semantics of the := variable substitution operator are not exactly equivalent to what you're asking about, but perhaps it's close enough.
Note that the default values are often set on a line which begins with the colon (basically "nop") shell command. It's different from the comment in that the rest of the line is evaluated by the shell. Anyway, see your shell's manual page for details.
Hi
I want to do a regex test and branch based on the test result, but this doesn't seems to work :confused:
if \) ]]
then
echo success
else
echo failed
fi (1 Reply)
Hello all,
I would like some help to find the regexp to test that a word does not contains anything than the character set of printable strings.
Especially the word should not contain a underscore.
echo "$word" | grep "( \'\(\)+,-\.:=\?)+"
if
then
echo success
else
echo failed... (2 Replies)
I'm almost pulling out my hair trying to figure out what's wrong with this... there's no reason I can see that it shouldn't be working. It seems that the code acts as though the conditional statement is true no matter what - I've even tried removing the negation operator, but it always goes into... (5 Replies)
I want to test if my host can connect to any of the following 10 hosts (192.168.1.0 to 192.168.1.9)
I didnt know which command i should use, so i chose ping. (i wonder if i should use tracepath or sth else)
my code is the following:
#!/bin/bash
clear
firstPart="192.168.1"
maxNum="9"
... (2 Replies)
This is the code:
while test 1 -eq 1
do
read a
$a
if test $a = stop
then
break
fi
done
I read a command on every loop an execute it.
I check if the string equals the word stop to end the loop,but it say that I gave too many arguments to test.
For example echo hello.
Now the... (1 Reply)
Hello,
We have to configure servers with a range of IPs which is in itself a subject for another script assistance request -but- we have run into quite a few IP ranges with routing problems lately.
I've been trying to figure out the best way to test a range of IPs, I mean, manually it's not... (4 Replies)
Hi,
I am unable to run a selective set of tests in gcc-4.5.1 test suite.
I tried two runtest commands given below (output is also given below).
Can you please guide me how to run specific set of tests for example :
I would like to run only tests gcc.target/i386/avx-vaddpd-1.c and ... (0 Replies)
Hi,
I have the following script under bash
if ; then
echo File $file_name Not Found
else
echo File $file_name Found
fi
I get the message
even the file is found; there is only one file with that name in the directory
I can't figure... (4 Replies)
Hello, can you please help me because I am totally confused with a simple script:
#!/bin/bash
] || ] && echo "Good Morning"
] || ] && echo "Good Night"
For me, these two strings are indentical: false || false and there is no point to execute echo command.
But the run result is... (5 Replies)
I want to check (using bash condition test function) if string contains three spaces, ignoring last three spaces at the end of string.
string_to_report='foo bar foo bar '
string_to_ignore='foo bar ' (8 Replies)