Ticket #45445: appify.sh

File appify.sh, 452 bytes (added by Dmole (Tim), 7 years ago)
Line 
1#!/bin/bash
2
3#
4# appify.sh
5#
6
7
8APP=$(which $1);
9APPNAME=$(echo $1 | perl -p -e 's/(\w)(\w*)/\u$1\L$2/g' );
10DIR="/Applications/$APPNAME.app/Contents/MacOS"
11if [ -a "/Applications/$APPNAME.app" ]; then
12  echo "First remove /Applications/$APPNAME.app";
13  exit 1
14fi
15mkdir -p "$DIR"
16echo -e "#!/bin/bash\n\n$APP" > "$DIR/$APPNAME"
17chmod +x "$DIR/$APPNAME"
18IMG=/opt/local/share/icons/hicolor/256x256/apps/$APP.png
19if [ -f $IMG ] ; then
20        echo $IMG
21fi
22exit 0;