Skip to content

Instantly share code, notes, and snippets.

@xgqfrms
Forked from mathiasbynens/appify
Last active April 9, 2024 06:39
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xgqfrms/d8797e253e8df0c5748ffbe9209bd07d to your computer and use it in GitHub Desktop.
Save xgqfrms/d8797e253e8df0c5748ffbe9209bd07d to your computer and use it in GitHub Desktop.
appify — create the simplest possible Mac app from a shell script

appify

#!/bin/bash

if [ "$1" = "-h" -o "$1" = "--help" -o -z "$1" ]; then cat <<EOF
appify v3.0.1 for Mac OS X - http://mths.be/appify
Creates the simplest possible Mac app from a shell script.

Appify takes a shell script as its first argument:

    `basename "$0"` my-script.sh

Note that you cannot rename appified apps. If you want to give your app
a custom name, use the second argument:

    `basename "$0"` my-script.sh "My App"

Copyright (c) Thomas Aylott <http://subtlegradient.com/>
Modified by Mathias Bynens <http://mathiasbynens.be/>
EOF
exit; fi

APPNAME=${2:-$(basename "$1" ".sh")}
DIR="$APPNAME.app/Contents/MacOS"

if [ -a "$APPNAME.app" ]; then
	echo "$PWD/$APPNAME.app already exists :("
	exit 1
fi

mkdir -p "$DIR"
cp "$1" "$DIR/$APPNAME"
chmod +x "$DIR/$APPNAME"

echo "$PWD/$APPNAME.app"
@xgqfrms
Copy link
Author

xgqfrms commented Dec 25, 2022

如何把一个 Shell 脚本打包成一个 macOS 桌面 App All In One
作者:xgqfrms
链接:https://www.cnblogs.com/xgqfrms/p/17004676.html
来源:https://www.cnblogs.com
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
©xgqfrms 2012-2022
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️

@xgqfrms
Copy link
Author

xgqfrms commented Dec 25, 2022

macOS App 如何一键快速复制粘贴 icons All In One

作者:xgqfrms
链接:https://www.cnblogs.com/xgqfrms/p/17004892.html
来源:https://www.cnblogs.com
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。
©xgqfrms 2012-2022
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️

@xgqfrms
Copy link
Author

xgqfrms commented Dec 25, 2022

@xgqfrms
Copy link
Author

xgqfrms commented Apr 9, 2024

#!/usr/local/bin/python3

echo "Python & Django & shell bin env ✅"

# $ chmod +x ./dev.sh
# $ chmod +x ./test.py

<<EOF

#!/usr/bin/env python
# ❌ env: python: No such file or directory

#!/usr/bin/python3
# ❌ ModuleNotFoundError: No module named 'django'

#!/usr/local/bin/python3
✅ django version = 5.0.4

EOF


<<EOF

$ which python 
python: aliased to /usr/local/bin/python3
$ which python3
/usr/bin/python3
$ which py3    
py3: aliased to python

EOF


<<EOF
$ ls -al //usr/bin | grep env
-rwxr-xr-x    1 root   wheel    135104 Dec 15 22:43 env
-rwxr-xr-x    1 root   wheel    133856 Dec 15 22:43 printenv
EOF

image

 $ ./dev.sh
  File "/Users/xgqfrms-mm/Documents/github/Django-Restful-API-Project/./dev.sh", line 17
    ✅ django version = 5.0.4
    ^
SyntaxError: invalid character '' (U+2705)

@xgqfrms
Copy link
Author

xgqfrms commented Apr 9, 2024

#!/usr/bin/env bash

#!/usr/bin/env bash

echo "Python & Django & shell bin env ✅"
echo 'Python & Django & shell bin env 🚀'

# $ chmod +x ./dev.sh
# $ chmod +x ./test.py

<<EOF

#!/usr/bin/env python
# ❌ env: python: No such file or directory

#!/usr/bin/python3
# ❌ ModuleNotFoundError: No module named 'django'

#!/usr/local/bin/python3
# ✅ django version = 5.0.4

EOF


<<EOF

$ which python 
python: aliased to /usr/local/bin/python3
$ which python3
/usr/bin/python3
$ which py3    
py3: aliased to python

EOF


<<EOF
$ ls -al //usr/bin | grep env
-rwxr-xr-x    1 root   wheel    135104 Dec 15 22:43 env
-rwxr-xr-x    1 root   wheel    133856 Dec 15 22:43 printenv
EOF

The echo utility writes any specified operands, separated by single blank (‘ ’) characters and followed by a newline (‘\n’) character, to the standard output.

@xgqfrms
Copy link
Author

xgqfrms commented Apr 9, 2024

#!/usr/bin/env bash

echo "Python & Django & shell bin env ✅"
echo 'Python & Django & shell bin env 🚀'

# $ chmod +x ./dev.sh
# $ chmod +x ./test.py

<<EOF

#!/usr/bin/env python
❌ env: python: No such file or directory

#!/usr/bin/python3
❌ ModuleNotFoundError: No module named 'django'

#!/usr/local/bin/python3
✅ django version = 5.0.4

EOF


<<EOF

$ which python 
python: aliased to /usr/local/bin/python3
$ which python3
/usr/bin/python3
$ which py3    
py3: aliased to python

EOF


<<EOF
$ ls -al //usr/bin | grep env
-rwxr-xr-x    1 root   wheel    135104 Dec 15 22:43 env
-rwxr-xr-x    1 root   wheel    133856 Dec 15 22:43 printenv
EOF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment