From: Karel Zak Date: Mon, 30 Sep 2013 13:49:00 +0000 (+0200) Subject: bash-completion: use '\n' as IFS when ask for filenames X-Git-Tag: v2.24-rc2~81 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ce3e6b15e2c4478b2df9a7016c168b16325abfb0;p=thirdparty%2Futil-linux.git bash-completion: use '\n' as IFS when ask for filenames The bash completion for more(1) treats the space-separated pieces of filenames as different files. $ touch foo\ bar $ more foo bar foo Reported-by: Ángel González Signed-off-by: Karel Zak --- diff --git a/bash-completion/blkid b/bash-completion/blkid index b439328587..9f97dd94ec 100644 --- a/bash-completion/blkid +++ b/bash-completion/blkid @@ -6,6 +6,7 @@ _blkid_module() prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-c') + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/colcrt b/bash-completion/colcrt index f9e4c333fc..c66d7e6d6e 100644 --- a/bash-completion/colcrt +++ b/bash-completion/colcrt @@ -19,6 +19,7 @@ _colcrt_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/column b/bash-completion/column index f5cb86b9c2..3af8e736ad 100644 --- a/bash-completion/column +++ b/bash-completion/column @@ -30,6 +30,7 @@ _column_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/cytune b/bash-completion/cytune index 4f42838050..f685c88ee6 100644 --- a/bash-completion/cytune +++ b/bash-completion/cytune @@ -33,6 +33,7 @@ _cytune_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- ${cur:-"/dev/tty"}) ) return 0 diff --git a/bash-completion/dmesg b/bash-completion/dmesg index 60ecc1af60..eab41ba086 100644 --- a/bash-completion/dmesg +++ b/bash-completion/dmesg @@ -6,6 +6,7 @@ _dmesg_module() prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-F'|'--file') + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/fallocate b/bash-completion/fallocate index 5007b605e0..2c6e4cbae7 100644 --- a/bash-completion/fallocate +++ b/bash-completion/fallocate @@ -20,6 +20,7 @@ _fallocate_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/findmnt b/bash-completion/findmnt index 9386d8f5a8..3ed331ac03 100644 --- a/bash-completion/findmnt +++ b/bash-completion/findmnt @@ -18,6 +18,7 @@ _findmnt_module() return 0 ;; '-F'|'--tab-file') + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/flock b/bash-completion/flock index 8cd60d33e5..8e7f8b8592 100644 --- a/bash-completion/flock +++ b/bash-completion/flock @@ -38,6 +38,7 @@ _flock_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- ${cur:-"/"}) ) return 0 diff --git a/bash-completion/fsck.cramfs b/bash-completion/fsck.cramfs index 84f6f31b46..acf656411d 100644 --- a/bash-completion/fsck.cramfs +++ b/bash-completion/fsck.cramfs @@ -6,6 +6,7 @@ _fsck.cramfs_module() prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-x'|'--destination') + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) ) return 0 diff --git a/bash-completion/hexdump b/bash-completion/hexdump index aa6f8cefd4..9dc2740769 100644 --- a/bash-completion/hexdump +++ b/bash-completion/hexdump @@ -40,6 +40,7 @@ _hexdump_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/hwclock b/bash-completion/hwclock index 0c4ebafc19..de1ac20f35 100644 --- a/bash-completion/hwclock +++ b/bash-completion/hwclock @@ -6,6 +6,7 @@ _hwclock_module() prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-f'|'--rtc'|'--adjfile') + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/ionice b/bash-completion/ionice index 3a01c5125f..1b1c5fe0ad 100644 --- a/bash-completion/ionice +++ b/bash-completion/ionice @@ -30,6 +30,7 @@ _ionice_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/last b/bash-completion/last index 493051e64d..c93be3d438 100644 --- a/bash-completion/last +++ b/bash-completion/last @@ -6,6 +6,7 @@ _last_module() prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-f') + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/ldattach b/bash-completion/ldattach index 830142d235..0b9d260345 100644 --- a/bash-completion/ldattach +++ b/bash-completion/ldattach @@ -42,6 +42,7 @@ _ldattach_module() return 0 ;; /*) + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/logger b/bash-completion/logger index f46be8ad02..963abc7040 100644 --- a/bash-completion/logger +++ b/bash-completion/logger @@ -6,6 +6,7 @@ _logger_module() prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-f'|'--file') + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/look b/bash-completion/look index e8676bae47..303a7565a3 100644 --- a/bash-completion/look +++ b/bash-completion/look @@ -20,6 +20,7 @@ _look_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/losetup b/bash-completion/losetup index 75240b8c93..874c549ae3 100644 --- a/bash-completion/losetup +++ b/bash-completion/losetup @@ -60,6 +60,7 @@ _losetup_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/lscpu b/bash-completion/lscpu index 27367426a9..7e189eee6b 100644 --- a/bash-completion/lscpu +++ b/bash-completion/lscpu @@ -42,6 +42,7 @@ _lscpu_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/lslocks b/bash-completion/lslocks index 337d07e04b..c9cff2c6b7 100644 --- a/bash-completion/lslocks +++ b/bash-completion/lslocks @@ -38,6 +38,7 @@ _lslocks_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/mcookie b/bash-completion/mcookie index eb3f54b5f7..4345b6e6c2 100644 --- a/bash-completion/mcookie +++ b/bash-completion/mcookie @@ -6,6 +6,7 @@ _mcookie_module() prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-f'|'--file') + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/mkfs.cramfs b/bash-completion/mkfs.cramfs index 38ab3b65f8..af74e1212a 100644 --- a/bash-completion/mkfs.cramfs +++ b/bash-completion/mkfs.cramfs @@ -36,6 +36,7 @@ _mkfs.cramfs_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/mkswap b/bash-completion/mkswap index c411b30054..b72efafd9a 100644 --- a/bash-completion/mkswap +++ b/bash-completion/mkswap @@ -28,6 +28,7 @@ _mkswap_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/more b/bash-completion/more index 945c7b3412..809cea2b35 100644 --- a/bash-completion/more +++ b/bash-completion/more @@ -21,6 +21,8 @@ _more_module() return 0 ;; esac + + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/mount b/bash-completion/mount index 2303cb7c19..db97a918ac 100644 --- a/bash-completion/mount +++ b/bash-completion/mount @@ -80,6 +80,7 @@ hfs nohfs romfs noromfs return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/mountpoint b/bash-completion/mountpoint index 8fe27b813e..f74efc9cc2 100644 --- a/bash-completion/mountpoint +++ b/bash-completion/mountpoint @@ -20,6 +20,7 @@ _mountpoint_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- ${cur:-"/"}) ) return 0 diff --git a/bash-completion/namei b/bash-completion/namei index 63fb37ac18..640273500a 100644 --- a/bash-completion/namei +++ b/bash-completion/namei @@ -16,6 +16,7 @@ _namei_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/nsenter b/bash-completion/nsenter index 2970b8d5ef..268f3782c5 100644 --- a/bash-completion/nsenter +++ b/bash-completion/nsenter @@ -40,6 +40,7 @@ _nsenter_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/pg b/bash-completion/pg index 9b1bad9309..8fce1302ab 100644 --- a/bash-completion/pg +++ b/bash-completion/pg @@ -25,6 +25,7 @@ _pg_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/pivot_root b/bash-completion/pivot_root index 961c883748..95df4b4d2f 100644 --- a/bash-completion/pivot_root +++ b/bash-completion/pivot_root @@ -11,6 +11,7 @@ _pivot_root_module() esac case $COMP_CWORD in 1|2) + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) ) ;; diff --git a/bash-completion/readprofile b/bash-completion/readprofile index a5f45f5640..bd265a69a2 100644 --- a/bash-completion/readprofile +++ b/bash-completion/readprofile @@ -6,6 +6,7 @@ _readprofile_module() prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-m'|'--mapfile'|'-p'|'--profile') + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/rename b/bash-completion/rename index 3842c4d149..81365a5b22 100644 --- a/bash-completion/rename +++ b/bash-completion/rename @@ -24,6 +24,7 @@ _rename_module() COMPREPLY=( $(compgen -W "replacement" -- $cur) ) ;; *) + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) ;; diff --git a/bash-completion/rev b/bash-completion/rev index 619c5c4f67..e5397d5d88 100644 --- a/bash-completion/rev +++ b/bash-completion/rev @@ -16,6 +16,7 @@ _rev_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/script b/bash-completion/script index 329fc482fa..d7efd7e7c2 100644 --- a/bash-completion/script +++ b/bash-completion/script @@ -32,6 +32,7 @@ _script_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/scriptreplay b/bash-completion/scriptreplay index 2ad7b118c7..a4aa8a08d2 100644 --- a/bash-completion/scriptreplay +++ b/bash-completion/scriptreplay @@ -24,6 +24,7 @@ _scriptreplay_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/setterm b/bash-completion/setterm index 7fa0a4e457..a7ef6ebed4 100644 --- a/bash-completion/setterm +++ b/bash-completion/setterm @@ -45,6 +45,7 @@ _setterm_module() return 0 ;; '-file') + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/sfdisk b/bash-completion/sfdisk index 0226b0483e..609104ca31 100644 --- a/bash-completion/sfdisk +++ b/bash-completion/sfdisk @@ -14,6 +14,7 @@ _sfdisk_module() return 0 ;; '-O'|'-I') + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/su b/bash-completion/su index e739b56d91..dad1b5f045 100644 --- a/bash-completion/su +++ b/bash-completion/su @@ -38,6 +38,7 @@ _su_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/swaplabel b/bash-completion/swaplabel index 093169e060..08aa9cd79f 100644 --- a/bash-completion/swaplabel +++ b/bash-completion/swaplabel @@ -24,6 +24,7 @@ _swaplabel_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/tailf b/bash-completion/tailf index e3dd295b1a..0d4c869c09 100644 --- a/bash-completion/tailf +++ b/bash-completion/tailf @@ -20,6 +20,7 @@ _tailf_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/tunelp b/bash-completion/tunelp index 614b2354f4..bd2cce2aa2 100644 --- a/bash-completion/tunelp +++ b/bash-completion/tunelp @@ -44,6 +44,7 @@ _tunelp_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- ${cur:-"/dev/lp"}) ) return 0 diff --git a/bash-completion/ul b/bash-completion/ul index c00e510f63..449cbe0543 100644 --- a/bash-completion/ul +++ b/bash-completion/ul @@ -25,6 +25,7 @@ _ul_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/utmpdump b/bash-completion/utmpdump index 48af5bc7f9..fb636c18a7 100644 --- a/bash-completion/utmpdump +++ b/bash-completion/utmpdump @@ -16,6 +16,7 @@ _utmpdump_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/uuidd b/bash-completion/uuidd index c45b0674c5..c8f6697c9b 100644 --- a/bash-completion/uuidd +++ b/bash-completion/uuidd @@ -6,16 +6,19 @@ _uuidd_module() prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-p'|'--pid'|'-s'|'--socket') + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 ;; '-T'|'--timeout') + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -W "timeout" -- $cur) ) return 0 ;; '-n'|'--uuids') + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -W "number" -- $cur) ) return 0 diff --git a/bash-completion/wall b/bash-completion/wall index 55d96587e8..e3145ff6d7 100644 --- a/bash-completion/wall +++ b/bash-completion/wall @@ -20,6 +20,7 @@ _wall_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- $cur) ) return 0 diff --git a/bash-completion/wdctl b/bash-completion/wdctl index 33b4e1ff61..4f16e76072 100644 --- a/bash-completion/wdctl +++ b/bash-completion/wdctl @@ -56,6 +56,7 @@ _wdctl_module() return 0 ;; esac + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -f -- ${cur:-"/dev/"}) ) return 0 diff --git a/bash-completion/whereis b/bash-completion/whereis index 2273a07c5d..0dcbac35bc 100644 --- a/bash-completion/whereis +++ b/bash-completion/whereis @@ -6,6 +6,7 @@ _whereis_module() prev="${COMP_WORDS[COMP_CWORD-1]}" case $prev in '-B'|'-M'|'-S') + local IFS=$'\n' compopt -o filenames COMPREPLY=( $(compgen -o dirnames -- ${cur:-"/"}) ) return 0