How can I test if line is empty in shell script?
Posted
by planetp
on Stack Overflow
See other posts from Stack Overflow
or by planetp
Published on 2010-04-05T11:33:26Z
Indexed on
2010/04/05
11:43 UTC
Read the original article
Hit count: 280
shell-scripting
|sh
I have a shell script like this:
cat file | while read line
do
# run some commands using $line
done
Now I need to check if the line contains any non-whitespace character ([\n\t ]), and if not, skip it. How can I do this?
© Stack Overflow or respective owner