-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathwrap.sh
executable file
·41 lines (31 loc) · 967 Bytes
/
wrap.sh
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
31
32
33
34
35
36
37
38
#! /bin/bash
[ -f ~/.bashrc ] && source ~/.bashrc
[ -f ~/.bash_profile ] && source ~/.bash_profile
if [ $# -eq 0 ]
then
echo "No arguments supplied"
echo "nohup wrap.sh wraptest.sh > /dev/null 2> /dev/null &"
echo "tail -f /tmp/shellout"
echo
echo "nohup wrap.sh qmv.sh > /dev/null 2> /dev/null &"
exit
fi
echo >> /tmp/shellout
echo ==== Starting $1 at `date` >> /tmp/shellout
IFS=';' read -a words <<<"$1"
for word in "${words[@]}"; do
if [[ $word == *sh ]] # * is used for pattern matching
then
## if ! [ -x "$(command -v stdbuf)" ]; then
echo "calling bash $word" >> /tmp/shellout
bash $word 2>> /tmp/shellout >> /tmp/shellout
## else
## echo "stdbuf $word" >> /tmp/shellout
## stdbuf -i0 -o0 -e0 bash $word 2>> /tmp/shellout >> /tmp/shellout
## fi
else
echo "Executing directly $word" >> /tmp/shellout
$word 2>> /tmp/shellout >> /tmp/shellout
fi
done
echo ==== Finished $1 at `date` >> /tmp/shellout