10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I'm writing a shell script and trying to grep a variable value, it works fine as long as there is a value in /tmp/list.out which is captured in $DSK but sometimes the file tends to be empty and that is where I'm having an issue while using grep which returns nothing. I know I can use something... (15 Replies)
Discussion started by: mbak
15 Replies
2. Shell Programming and Scripting
hi,
i want to check whether a a variable contains some value or is empty in a shell script. so if the variable contains some value i want to do some job and if the variable doesnt contain any value then i need to skip that job.
here is a sample script
read_filenames.sh contains
... (5 Replies)
Discussion started by: Little
5 Replies
3. Shell Programming and Scripting
I feel like it is just a matter of using the $ operators correctly, but I can't seem to get it...
hostname="network"
ip="192.168.1.1"
netmask=""
variables=( $hostname $ip $netmask )
for var in ${variables}
do
if ; then
$var="--"
fi
done
echo... (7 Replies)
Discussion started by: etranman1
7 Replies
4. Shell Programming and Scripting
Hi Folks,
I am trying to read input from single line from a file and pass the read variable to one of the commands. However when I run the script it keeps the variable to be empty. I can however echo the variable ( but why it is empty when it goes to the command).
Any help will be... (6 Replies)
Discussion started by: bhadu
6 Replies
5. Shell Programming and Scripting
Hi,
I'm working on a script that will take the contents of a file, that is in a row and column format, and compare it to a arrangment file. Such that if there is any or all blanks in my content file, the blank will be filled with a flag and will retain the row and column configuration.
Ex.
... (2 Replies)
Discussion started by: hizzle
2 Replies
6. Shell Programming and Scripting
I have a variable with a new line. I want to check this variable for empty or a new line
Can anyone advise (4 Replies)
Discussion started by: Muthuraj K
4 Replies
7. Shell Programming and Scripting
How to check the variable is empty or not?
aaa=" "
how to check aaa variable is empty or just spacing?
If only spacing inside.. it will asume it is empty.
some are 6 spacing, or 8 spacing.. as long as variable is empty with spacing..
anyone can help me? (2 Replies)
Discussion started by: ryanW
2 Replies
8. Shell Programming and Scripting
i am finding some pattern this way..
fname=`grep -w "^$index" $HOME/UnixCw/backup/Path.txt`
how to check that fname is empty i.e. if pattren doesnt found then i want to do other operations.... (7 Replies)
Discussion started by: AbhijitIT
7 Replies
9. UNIX for Dummies Questions & Answers
sorry for the title of this thread-
I figured out how to capture empty variable by using-
if
then
........
This thread originally had two parts in it (one for capturing empty variable and the other to get the date time in 14 char format). Once I figured out the solution for the first part... (6 Replies)
Discussion started by: radhika
6 Replies
10. Shell Programming and Scripting
I am trying to assign list of files that created that day to a variable 'filename'
filename=`ls -ltr |grep "Mar 6" | awk '{print$9}'`
If there are no files created that day, my script just hangs, i need help with some login here.
i am also trying to figure out a way to look for files that... (3 Replies)
Discussion started by: gundu
3 Replies