Added basic teaching mode

https://github.com/Bash-it/bash-it/issues/674
pull/1323/head
Jus de Patate 2019-02-04 11:50:43 +01:00 committed by GitHub
parent 71ee7083cf
commit 782b5c4c57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,34 @@
# requested by greenrd on a issue https://github.com/Bash-it/bash-it/issues/674
function yes() {
if [ "$1" = "-ok" ]; then
shift
$(which yes) $*
else
echo "bash-it: this command will spam your terminal (use arg -ok to skip warning)"
exit 1
fi
}
function ls() {
if [[ -f ${*: -1:1} ]]; then
echo "bash-it: ${*: -1:1} is a file not a folder"
exit 1
else
$(which ls) $*
fi
}
function cat() {
if [[ -d ${*: -1:1} ]]; then
echo "bash-it: ${*: -1:1} is a folder not a file"
exit 1
else
$(which cat) $*
fi
}
function rm() {
if [[ -d ${*: -1:1} ]]; then
$(which rm) -r $*
else
$(which rm) $*
fi
}