Nice approach! In fact, with the %d format specifier, you don't need the +0 as both an empty or a string field would result in a 0 to be printed:
The only drawback is when a field has a string starting with numeric characters like
Your approach:
My approach:
The OP needs to decide which one would satisfy his/her needs.
Hi All,
I am checking for a empty input file to do some further action , but I am getting exit status 0 in both the cases , for empty and non empty file both.
The value of $? is coming 0 in if part also and else part too.
#!/bin/ksh
if ]; then
echo "data"
# exit 0
echo "$?"
else... (4 Replies)
Hi,
I created the following shell script to lookup multiple name servers for a domain.
#!/bin/bash
echo -n "Enter the domain name and press : "
read domain
result1=`dig +short $domain @4.2.2.1`
revresult1=`host $result1 | cut -f5 -d " "`
echo "test1"
result2=`dig +short... (3 Replies)
So, I will be working with someone and basically we are trying to build a form that is submitted most likely via the web and the data is just a string of numbers.
like:
19383882872201110929282821818182827349190102837364718191001932873711
Now, each number is part of a numerical value of... (4 Replies)
I have a local linux machine in which the files are dumped by a remote ubuntu server. If the process in remote server has any problem then empty files are created in local machine. Is there any way using perl script to check if the empty files are being created and delete them and then run a shell... (2 Replies)
I'm trying to write a shell script to files of zero length in a specified directory, but I keep getting errors. Would anybody be kind enough to look it over for issues? Thanks a bunch in advance.
#!/bin/sh
if
then
if
then
find $1 -type f -size 0 -print|xargs rm
exit 0... (1 Reply)
I have a script that runs ditto for me, and occasionally (if I exit the script while ditto is running in the background) it will leave an empty file named 0 in the script's directory. The next time I run the script, it generates incorrect data because of this file. I know I can easily insert a... (1 Reply)
I have a script that runs ditto for me, and occasionally (if I exit the script while ditto is running in the background) it will leave an empty file named 0 in the script's directory. The next time I run the script, it generates incorrect data because of this file. I know I can easily insert a... (1 Reply)
Hi,
I am unable to get $HOSTNAME value in a remote script when executed through SSH. Also the scripts hangs and doesnt return to the calling environment.
For instance
command -
ssh user1@box2 "cd /var/home/bin ; ./generateScript.sh"
Can any one plese throw light on the issue and... (5 Replies)