10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all,
I'm using Bash 4.3.8 on an Ubuntu system, and no matter what I try, incrementing a counter won't work. The simplest example would be something like this:
#!/bin/bash
myVar=0
myVar=$((myVar++))
echo myVar
The variable should be 1, but it's always 0. I've tried every increment... (6 Replies)
Discussion started by: Zel2008
6 Replies
2. Shell Programming and Scripting
hello
this script should show all users and space they used without problem :
ls /home >> /root/users.txt
cat /root/users.txt | while read line; do
space=`du -s /home/$line`
echo "$line space is $space"
shift
done
but when i remove pipe ,script run without any output:
ls /home... (4 Replies)
Discussion started by: nimafire
4 Replies
3. Shell Programming and Scripting
Hi,
i have a scenario were i should compare a few fields from each line then increment a variable based on that.
Example file
989878|8999|Y|0|Y|N|V
989878|8999|Y|0|N|N|V
989878|8999|Y|2344|Y|N|V
i have 3 conditions to check and increment a variable on every line
condition 1 if ( $3... (4 Replies)
Discussion started by: selvankj
4 Replies
4. UNIX for Dummies Questions & Answers
Hi Experts,
I am in need for some help. My competence level on unix is not at all helping me to resolve this. Please help.
My Input for a system command is as under:
Counters are getting pegged each hour. I need to have a difference printed rather than pegged counter values.
Counter... (2 Replies)
Discussion started by: vanand420
2 Replies
5. Shell Programming and Scripting
I have this file
1801,A1,2012-12-16 15:59:59.995,id2_3,ab,phoneC2-00,VOE,,,,,,,,,,,,,,,
1802,A1,2012-12-16 15:59:59.995,id2_3,ab=,phoneX1-01,BL,,,,,,,,,,,,,,,
1803,A1,2012-12-16 15:59:59.995,id2_3,ab,phone300,BL,,,,,,,,,,,,,,,
1804,A1,2012-12-16... (4 Replies)
Discussion started by: nikhil jain
4 Replies
6. Shell Programming and Scripting
if ;then
echo "mrnet greater 5000"
gzip /var/log/mrnet.log
mv /var/log/mrnet.log.gz /var/log/mrnet.log.1.gz
if ];then
i=1
let i++
mv /var/log/mrnet.log.1.gz /var/log/vieux-logs/mrnet.log.$i.gz
else
echo "theres no... (1 Reply)
Discussion started by: Froob
1 Replies
7. Shell Programming and Scripting
Hi,
I would like to add a suffix to a file name but maintain the suffix length to 5 digits.
For eg,
output > 1st_file.00001, 2nd_file.00002...10th_file.00010....100th_file.00100
Can anyone please advise me on how to go about it?
Platform: SunOS mps201a 5.9 Generic_118558-39 sun4u... (7 Replies)
Discussion started by: danish0909
7 Replies
8. Shell Programming and Scripting
Hi !
How to increment a varibale in ksh.
#!/bin/ksh
set -x
RELEASE_NUM=5.2.103
VAL=0.0.1
RELEASE_NUM=`echo $RELEASE_NUM + $VAL | bc`
echo $RELEASE_NUM
The above code is throwing this error.
+ RELEASE_NUM=5.2.103 (2 Replies)
Discussion started by: dashok.83
2 Replies
9. Shell Programming and Scripting
Hi,
I need some help.
Shell script counter. i need to add condition to check if counter is more than 10 and longer than 3 hours? it runs every 5 mins. it only check count and send email right now.
it runs in cron as below
gregcount.ksh gregdb 10 > /tmp/gregcount.out 2> /tmp/gregcount.err
... (1 Reply)
Discussion started by: pega
1 Replies
10. UNIX for Dummies Questions & Answers
Simple script trying to increment a counter within an echo statement never gets past 1 - PLEASE HELP!
Thanks.
~~~~~~~~~~~
#!/bin/sh
stepup()
{
STEP=`expr $STEP + 1`
echo $STEP
}
#
# Initialize variables
#
STEP=0
echo "Counter Value: `stepup`"
echo "Counter Value:... (2 Replies)
Discussion started by: blaze
2 Replies