10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
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)
Discussion started by: useretail
8 Replies
2. Shell Programming and Scripting
Hey guys,
I'm fairly new to bash scripting, so bear with me :)
What I want to achieve is reading a file (.php), find the phrase 'WACHTWOORD' (password) in it, and collect the password and a part of the filename in a list.
The filename is always 'settings_{name}.php' and the part I'm looking... (6 Replies)
Discussion started by: Eggie01
6 Replies
3. Shell Programming and Scripting
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)
Discussion started by: AndreiM
5 Replies
4. Shell Programming and Scripting
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)
Discussion started by: f_o_555
4 Replies
5. Shell Programming and Scripting
Experts,
I have a bash shell script that generates 2 variables that have the current minute and a minute from a log file. Can someone please show me the best way to test if the minutes stray by 5. So basically if:
This is ok:
Last Fitting Min
=============
02
Current Minute
=============... (2 Replies)
Discussion started by: jaysunn
2 Replies
6. Shell Programming and Scripting
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)
Discussion started by: Max89
1 Replies
7. Shell Programming and Scripting
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)
Discussion started by: shadow_boi
2 Replies
8. UNIX for Dummies Questions & Answers
Good Day,
Im new to scripting especially awk and sed. I just would like to ask help from you guys about a sed command that prints the line immediately after a regexp, but not the line containing the regexp.
sed -n '/regexp/{n;p;}' filename
What if my regexp is 3 word or a sentence. Im... (3 Replies)
Discussion started by: ownins
3 Replies
9. Shell Programming and Scripting
I'm not talking about the assembly instruction TAS, a better name could be check-and-set :) Anyway, is there a way to simplify the following
if ; then VAR="something"; fi
I have ~20 variables that should be test-and-set like this, and it really looks lame. (2 Replies)
Discussion started by: rayne
2 Replies
10. Shell Programming and Scripting
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)
Discussion started by: subin_bala
1 Replies