vim new file
This commit is contained in:
+14
@@ -0,0 +1,14 @@
|
||||
alias l='colorls -G'
|
||||
alias ll='colorls -Gl'
|
||||
alias la='colorls -GA'
|
||||
alias lla='colorls -GAl'
|
||||
|
||||
alias ..='cd ..'
|
||||
alias ...='cd ../..'
|
||||
alias ....='cd ../../..'
|
||||
|
||||
alias grep='grep --color=auto'
|
||||
|
||||
alias cp="cp -i"
|
||||
alias df='df -h'
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
#!/bin/ksh
|
||||
|
||||
# Colors
|
||||
RESET="$(printf '\033[0m')"
|
||||
BLUE="$(printf '\033[1;34m')"
|
||||
RED="$(printf '\033[1;31m')"
|
||||
|
||||
if [ "$#" -eq 0 ]; then
|
||||
echo "usage: srm file ..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for file in "$@"; do
|
||||
if [ ! -e "$file" ]; then
|
||||
echo "srm: $file: No such file"
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ -d "$file" ]; then
|
||||
echo "srm: $file: is a directory"
|
||||
continue
|
||||
fi
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Show filename in blue
|
||||
# --------------------------------------------------------
|
||||
|
||||
printf "%s------------------------------------------------------------%s\n" \
|
||||
"$BLUE" "$RESET"
|
||||
|
||||
printf "%sFile: %s%s\n" \
|
||||
"$BLUE" "$file" "$RESET"
|
||||
|
||||
printf "%s------------------------------------------------------------%s\n" \
|
||||
"$BLUE" "$RESET"
|
||||
|
||||
# Show first 10 lines of file
|
||||
head -n 10 -- "$file"
|
||||
|
||||
printf "%s------------------------------------------------------------%s\n" \
|
||||
"$BLUE" "$RESET"
|
||||
|
||||
# --------------------------------------------------------
|
||||
# Confirmation in red
|
||||
# --------------------------------------------------------
|
||||
|
||||
printf "%sDelete '%s'? [y/N] %s" \
|
||||
"$RED" "$file" "$RESET"
|
||||
|
||||
read answer
|
||||
|
||||
case "$answer" in
|
||||
y|Y|yes|YES)
|
||||
rm -- "$file"
|
||||
;;
|
||||
*)
|
||||
echo "Not deleted: $file"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
Reference in New Issue
Block a user