commit 63de9db030cedb8585044e8856b03bf5a3e228b4
parent d65759220b6b5d3b81f573dbf50f476ad5007069
Author: parazyd <parazyd@dyne.org>
Date: Sun, 31 Jul 2016 10:11:30 +0200
make scripts more portable (ex. for *ash)
Diffstat:
9 files changed, 16 insertions(+), 18 deletions(-)
diff --git a/addrepo.sh b/addrepo.sh
@@ -31,7 +31,7 @@ EOF
fi
}
-if [[ -n $reponame ]] && [[ -n $repodesc ]]; then
+if [ -n $reponame ] && [ -n $repodesc ]; then
cd $GITOLITE
writeconf >> conf/gitolite.conf
git commit conf/gitolite.conf -m "added $reponame repository"
diff --git a/autoup b/autoup
@@ -10,4 +10,4 @@ test -z "$1" && exit 1 || filename=$(basename $1)
scp -i "$sshkey" "$1" "${sshuser}@${server}:${webroot}/${webdir}/${filename}"
echo "https://$server/$webdir/$filename" | xclip -i
echo "https://$server/$webdir/$filename"
-rm $1
+#rm $1
diff --git a/dmenuwindows b/dmenuwindows
@@ -31,5 +31,5 @@ num=$(wmctrl -l \
| cut -d '-' -f -1 \
)
-[[ -z "$num" ]] && exit
+[ -z "$num" ] && exit
wmctrl -l | sed -n "$num p" | cut -c -10 | xargs wmctrl -i -a
diff --git a/genhtpasswd b/genhtpasswd
@@ -7,7 +7,7 @@ user="$1"
realm="$2"
password="$3"
-if ! [[ -n $user ]] || ! [[ -n $realm ]] || ! [[ -n $password ]]; then
+if [ -z $user ] || [ -z $realm ] || [ -z $password ]; then
echo "usage: `basename $0` [user] [realm] [password]"
else
echo -n "${user}:${realm}:" \
diff --git a/minimpc b/minimpc
@@ -6,7 +6,7 @@
MPDHOST=${MPDHOST:-"/home/parazyd/.config/mpd/mpd.sock"}
# MPDHOST=${MPDHOST:-"127.0.0.1 6600"}
-if [[ $MPDHOST == /* ]] || [[ $MPDHOST == ~/* ]]; then
+if [ $MPDHOST == /* ] || [ $MPDHOST == ~/* ]; then
NCARGS="-U"
else
NCARGS=""
diff --git a/p b/p
@@ -4,13 +4,13 @@ palemoon=/usr/bin/palemoon
profile="$1"
ps ax | grep '[p]alemoon' > /dev/null
-[[ $? = 0 ]] && {
+[ $? = 0 ] && {
# one is already running, run next with -no-remote
opts=" -no-remote "
}
case $profile in
- obi) $palemoon ${opts} -P def;;
- soc) $palemoon ${opts} -P soc;;
- profile*) $palemoon -ProfileManager;;
- *) $palemoon $*;;
+ obi) exec $palemoon ${opts} -P def;;
+ soc) exec $palemoon ${opts} -P soc;;
+ profile*) exec $palemoon -ProfileManager;;
+ *) exec $palemoon $*;;
esac
diff --git a/skrot b/skrot
@@ -1,6 +1,6 @@
#!/bin/sh
-if [ $1 == "-s" ]; then
+if [ "$1" == "-s" ]; then
scrot -s '%Y-%m-%d_%H-%M-%S_$wx$h.png' -e 'mv $f ~/screenshots/'
else
scrot '%Y-%m-%d_%H-%M-%S_$wx$h.png' -e 'mv $f ~/screenshots/'
diff --git a/supadd b/supadd
@@ -48,19 +48,17 @@ EOF
getsha() {
shasum=`sha256sum $binpath | awk '{print $1}'`
- [[ -n $shasum ]] || exit 1
+ [ -n $shasum ] || exit 1
}
case $1 in
-l) grep -v -i -e '//' -e '^#' $supsrc/allowed.txt ;;
*)
binpath="$1"
bin=`echo $binpath | awk -F"/" '{print $NF}'`
- if ! [[ $binpath == /* ]]; then
- binpath="$PWD/$bin"
- fi
+ [ $binpath == /* ] || binpath="$PWD/$bin"
getsha || exit 1
- if [[ `grep $binpath $supsrc/allowed.txt` ]]; then
+ if [ `grep $binpath $supsrc/allowed.txt` ]; then
grep -v $binpath $supsrc/allowed.txt > /tmp/allowed.txt
mv /tmp/allowed.txt $supsrc/allowed.txt
fi
diff --git a/xkcd.py b/xkcd.py
@@ -4,7 +4,7 @@
# random xkcd comic
import urllib, json, random
-latest = 1700
-num=str(random.randint(1,latest))
+latest = 1710
+num = str(random.randint(1,latest))
info = json.load(urllib.urlopen("http://www.xkcd.com/" + num + "/info.0.json"))
print info['img']