diff options
author | LAN-TW <lantw44@gmail.com> | 2013-11-30 21:48:42 +0800 |
---|---|---|
committer | LAN-TW <lantw44@gmail.com> | 2013-11-30 21:51:59 +0800 |
commit | d8930900ce078b21b2d4e7a5387b6c33f6f6aa04 (patch) | |
tree | 6fafd088fa44b642cab2f26884c5a0d251a9c162 /bash_include | |
parent | a64a9be29166f10f30c63d38b47c52903c7fb9b5 (diff) | |
download | configfile-d8930900ce078b21b2d4e7a5387b6c33f6f6aa04.tar configfile-d8930900ce078b21b2d4e7a5387b6c33f6f6aa04.tar.gz configfile-d8930900ce078b21b2d4e7a5387b6c33f6f6aa04.tar.bz2 configfile-d8930900ce078b21b2d4e7a5387b6c33f6f6aa04.tar.lz configfile-d8930900ce078b21b2d4e7a5387b6c33f6f6aa04.tar.xz configfile-d8930900ce078b21b2d4e7a5387b6c33f6f6aa04.tar.zst configfile-d8930900ce078b21b2d4e7a5387b6c33f6f6aa04.zip |
bash_include: argv[0]、重複執行、等待成功、fbterm_chewing、更多指令自動完成
Diffstat (limited to 'bash_include')
-rw-r--r-- | bash_include | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/bash_include b/bash_include index a5fa088..b7510a7 100644 --- a/bash_include +++ b/bash_include @@ -1316,6 +1316,41 @@ function get_memory_info () esac } +function argv0 () +{ + local execname="$1" + local argv0="$2" + shift 2 + ( exec -a "$argv0" "$execname" "$@" ) +} + +function repeat () +{ + local repeat_times="$1" + shift + for ((i=0; i<repeat_times; i++)) + do + "$@" + done +} + +function wait_success () +{ + local i=1 + until "$@"; do echo "Failed ... $i"; ((i++)) ; done +} + +function fbterm_chewing () +{ + if [ -z "$1" ]; then + fbterm -s 14 -- uim-fep -u chewing + else + local font_size="$1" + shift + fbterm -s "$font_size" "$@" -- uim-fep -u chewing + fi +} + function set_console_title () { case "$TERM" in @@ -1654,14 +1689,18 @@ function help_function () mvfile [-n] filenames ... [-- sudo_prefix ...] varset variables ... <<< Tools: Non-interactive >>> + argv0 executable arguments ... (include argv[0]) backup_file filename ... [-- sudo_prefix ...] convert_to_html filename ... mkscreenacl usernames ... + repeat times arguments ... + wait_success arguments ... <<< Miscellaneous: Background Jobs >>> check_dmesg seconds check_system_status seconds <<< Miscellaneous: Compatibility >>> + fbterm_chewing [size] [arguments ...] gen_ms_inet_shortcut filename url unzip_nomac filenames ... <<< Miscellaneous: Personal >>> @@ -1787,6 +1826,8 @@ shopt -s checkhash shopt -s cmdhist shopt -s mailwarn +complete -A alias helpa +complete -A alias help_aliases complete -A command check_command_existent complete -A directory createdir_askmode complete -A function helpf @@ -1795,6 +1836,19 @@ complete -A variable varset complete -A variable path_editor complete -A user mkscreenacl +if check_command_existent _command; then + complete -F _command wait_success +fi + +if check_command_existent _screen; then + complete -F _screen screen256 +fi + +if check_command_existent _rpmdev_installed_packages; then + complete -F _rpmdev_installed_packages rpmdu + complete -F _rpmdev_installed_packages rpmsize +fi + ulimit -S -c unlimited 2> /dev/null [ "$interactive_shell" ] && { |