[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Problems with command substitution and command alias
From: |
Hyunho Cho |
Subject: |
Problems with command substitution and command alias |
Date: |
Sun, 22 Nov 2020 00:04:21 +0900 |
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2
-fdebug-prefix-map=/build/bash-a6qmCk/bash-5.0=.
-fstack-protector-strong -Wformat -Werror=format-security -Wall
-Wno-parentheses -Wno-format-security
uname output: Linux EliteBook 5.4.0-42-generic #46-Ubuntu SMP Fri Jul
10 00:24:02 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.0
Patch Level: 17
Release Status: release
###############################################################
### 1.
if command does not exist then the command stop with "command not found"
error
but the command substitution executed completely
if i run following command ( including "prompt$" )
then "command not found" error occurred
but "$( mktemp -d -p /dev/shm )" command substitution executed completely
prompt$ cd $(mktemp -d -p /dev/shm) &&
( curl -L https://ftp.gnu.org/gnu/bash/bash-5.1-rc3.tar.gz | tar xvz &&
cd bash-5.1-rc3 && ./configure && make -j `nproc` && strip bash ) &&
mv bash-5.1-rc3/bash "$OLDPWD" && rm -rf "$PWD" && cd -
bash-5.0: prompt$: command not found
$ ls -l /dev/shm/
total 0
drwx------ 2 mug896 mug896 40 2020-11-21 23:22 tmp.WK0k0MWZ2n/
-----------------------------------------------------------------------------------------------
### 2.
alias-expand-line readline function affects not only command line but also
heredoc contents
if i set up a command alias like below. it works well as expected.
$ alias foo='make -f- << "EOF" 2> /dev/null'
$ foo
foo := 100
$(info $(foo))
EOF
100 # result
but if i hit a key that is bound to alias-expand-line readline function
for add more command line options of make
then foo is expanded not only in command line but also in heredoc contents
$ make -f- << "EOF" 2> /dev/null
make -f- << "EOF" 2> /dev/null := 100
$(info $(make -f- << "EOF" 2> /dev/null))
EOF
- Problems with command substitution and command alias,
Hyunho Cho <=