1
2
3
4
5
6
7
8
9
10
11
while [ 1 ]
do
lsof | grep $log_file > /dev/null 2>&1
sleep 60
echo $?
if [ "$?" = "1" ]
then
echo "$log_file is currently not in use!"
break
fi
done
1
2
3
4
5
6
7
8
9
10
11
while [ 1 ]
do
sleep 60
lsof | grep $log_file > /dev/null 2>&1
echo $?
if [ "$?" = "1" ]
then
echo "$log_file is currently not in use!"
break
fi
done
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
echo "first try"
# command with return code != 0 (so, failed)
false
echo "rc: $?"
# beware! now $? is set by echo
if [ $? -ne 0 ] ; then
echo "command failed."
else
echo "command successfully executed."
fi
####
echo "next try"
false
RC=$?
echo "rc: $RC"
if [ $RC -ne 0 ] ; then
echo "command failed."
else
echo "command successfully executed."
fi