command-substitution

xargs: command substitution $(…) with pipe doesn't work

风格不统一 提交于 2020-05-25 04:46:08
问题 I'm trying to write short script, and the following command: echo "aaa111 bbb111" | xargs -I {} echo {} | sed 's/111/222/g' returns aaa222 bbb222 , which is what I expect. I expected the next command: echo "aaa111 bbb111" | xargs -I {} echo $(echo {} | sed 's/111/222/g') to return the same, but it returns aaa111 bbb111 ! Why is that? UPD: What I'm trying to achieve: I have many files like pic30-coff-gcc , pic30-coff-ag , etc, and I need to make a symlink for each file, like pic30-gcc -> pic30

How do I use command substition in Dockerfile

偶尔善良 提交于 2020-05-11 16:15:11
问题 In my Dockerfile I need to use command substition to add some environment variables. I want to set ENV PYTHONPATH /usr/local/$(python3 -c 'from distutils import sysconfig; print(sysconfig.get_python_lib())') but it doesn't work. The result is foo@bar:~$ echo $PYTHONPATH /usr/local/$(python3 -c from distutils import sysconfig; print(sysconfig.get_python_lib())) What's wrong? 回答1: What went wrong The $( ... ) command substitution you attempted is for Bash, whereas the Dockerfile is not Bash. So

How do I use command substition in Dockerfile

帅比萌擦擦* 提交于 2020-05-11 16:12:59
问题 In my Dockerfile I need to use command substition to add some environment variables. I want to set ENV PYTHONPATH /usr/local/$(python3 -c 'from distutils import sysconfig; print(sysconfig.get_python_lib())') but it doesn't work. The result is foo@bar:~$ echo $PYTHONPATH /usr/local/$(python3 -c from distutils import sysconfig; print(sysconfig.get_python_lib())) What's wrong? 回答1: What went wrong The $( ... ) command substitution you attempted is for Bash, whereas the Dockerfile is not Bash. So

How do I use command substition in Dockerfile

旧城冷巷雨未停 提交于 2020-05-11 16:10:09
问题 In my Dockerfile I need to use command substition to add some environment variables. I want to set ENV PYTHONPATH /usr/local/$(python3 -c 'from distutils import sysconfig; print(sysconfig.get_python_lib())') but it doesn't work. The result is foo@bar:~$ echo $PYTHONPATH /usr/local/$(python3 -c from distutils import sysconfig; print(sysconfig.get_python_lib())) What's wrong? 回答1: What went wrong The $( ... ) command substitution you attempted is for Bash, whereas the Dockerfile is not Bash. So

How do I use command substition in Dockerfile

大城市里の小女人 提交于 2020-05-11 16:10:07
问题 In my Dockerfile I need to use command substition to add some environment variables. I want to set ENV PYTHONPATH /usr/local/$(python3 -c 'from distutils import sysconfig; print(sysconfig.get_python_lib())') but it doesn't work. The result is foo@bar:~$ echo $PYTHONPATH /usr/local/$(python3 -c from distutils import sysconfig; print(sysconfig.get_python_lib())) What's wrong? 回答1: What went wrong The $( ... ) command substitution you attempted is for Bash, whereas the Dockerfile is not Bash. So

How do I use command substition in Dockerfile

假如想象 提交于 2020-05-11 16:09:47
问题 In my Dockerfile I need to use command substition to add some environment variables. I want to set ENV PYTHONPATH /usr/local/$(python3 -c 'from distutils import sysconfig; print(sysconfig.get_python_lib())') but it doesn't work. The result is foo@bar:~$ echo $PYTHONPATH /usr/local/$(python3 -c from distutils import sysconfig; print(sysconfig.get_python_lib())) What's wrong? 回答1: What went wrong The $( ... ) command substitution you attempted is for Bash, whereas the Dockerfile is not Bash. So

How to set environment variable within GDB using shell command?

人走茶凉 提交于 2020-03-21 16:04:25
问题 I want to run gdb with only a single variable MyVar in its environment. However, the variable's contents are rather complex, containing non-printable ASCII, and so is best set using e.g. MyVar=$(python -c 'print("\xff...")') . I'm left with two options: Set the MyVar in bash before running gdb . Then inside gdb , remove all other environment variables individually using unset environment NAME ( very tedious! ). Clear all environment variables using unset environment . Then inside gdb , set

How to set environment variable within GDB using shell command?

穿精又带淫゛_ 提交于 2020-03-21 16:01:27
问题 I want to run gdb with only a single variable MyVar in its environment. However, the variable's contents are rather complex, containing non-printable ASCII, and so is best set using e.g. MyVar=$(python -c 'print("\xff...")') . I'm left with two options: Set the MyVar in bash before running gdb . Then inside gdb , remove all other environment variables individually using unset environment NAME ( very tedious! ). Clear all environment variables using unset environment . Then inside gdb , set