Last active
July 22, 2019 15:19
-
-
Save debxp/757154bb9651952ca8a71cc486a7729b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env bash | |
# O caminho para a minha pasta local | |
# de executáveis... | |
script_path="$HOME/.local/bin" | |
# O editor da minha preferência... | |
script_editor="geany" | |
# O nome e o caminho do script... | |
script_file="$script_path/$1" | |
# Se o nome do script não foi passado | |
# como argumento, abortar... | |
if [[ -z "$@" ]]; then | |
echo -e "\n\nError!\nUsage: ssgen script_name\n\n" | |
exit 0; | |
fi | |
# Se foi passado, mas o arquivo não existe, | |
# ele é criado... | |
if [[ ! -f $script_file ]]; then | |
echo '#!/usr/bin/env bash' > $script_file | |
chmod +x $script_file | |
fi | |
# Existindo antes ou tendo sido criado agora, | |
# o script é aberto no editor... | |
eval $script_editor $script_file | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment