2022-10-27 03:18:56 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Script to create script
|
|
|
|
|
|
|
|
if [ -z "$1" ]; then
|
2023-06-14 20:31:12 +02:00
|
|
|
echo "Usage: script <scriptname>"
|
2022-10-27 03:18:56 +02:00
|
|
|
exit
|
|
|
|
fi
|
|
|
|
|
|
|
|
path="$HOME/.bin/$1"
|
|
|
|
|
|
|
|
# Prevent overwriting existing script
|
|
|
|
set -o noclobber
|
|
|
|
|
|
|
|
# Create script
|
2022-10-27 03:29:24 +02:00
|
|
|
cat > "$path" << EOF
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
2022-10-27 03:18:56 +02:00
|
|
|
chmod +x "$path"
|
2022-10-27 03:29:24 +02:00
|
|
|
|
|
|
|
# Open script in editor on line 3
|
|
|
|
"$EDITOR" +3 "$path"
|