Tagged Questions
1
vote
1answer
60 views
escaping spaces in shell script
yesterday="2010-06-23 00:00:00"
today="2010-06-24 00:00:00"
mywhere="lastupdate>'$yesterday' and lastupdate<'$today'"
mysqldump $param ticket --no-create-info --where=\"$mywhere\"
The last ...
-1
votes
1answer
126 views
shell script - while loop, handle the exception
I am running a shell script with a while loop and it exits with the below error, how could I avoid it or catch the error and let the loop to continue ? ie how could I handle the exception
stty: ...
-1
votes
4answers
94 views
Shell script for loop is behaving unexpected [closed]
Shell script for loop is behaving unexpected ! The requirement is need to iterate the loop line by line of the property file. Its mandatory to use the for loop.
hostnamefl=/tmp/propperty.txt
for ...
1
vote
3answers
103 views
Logging with timestamp
I am trying to prepend log entries with a timestamp, but the generated timestamps do not seem to change over time:
#!/bin/sh
NOW=$(date +"%Y-%m-%d %H:%M:%S")
echo "$NOW Logging something"
sleep 2
...
0
votes
2answers
82 views
export command within shell script
When I use export command at command prompt, it works as expected. But it does not work from shell script.
[root@server shantanu]# export myip=10
[root@server shantanu]# echo $myip
10
[root@server ...
0
votes
2answers
44 views
Highlight code line by line
Following is the shell script that is expected to pick one line at a time from a given file highlight it.
#!/bin/sh
> myhighlight.txt
file='to_study.php'
cat $file | while read -r myline
do
export ...