我需要将命令的输出分配给变量。我试过的命令是:
grep UUID fstab | awk '/ext4/ {print $1}' | awk '{print substr($0,6)}'
我尝试使用此代码分配变量:
UUID=$(grep UUID fstab | awk '/ext4/ {print $1}' | awk '{print substr($0,6)}')
但是,它给出了语法错误。此外,我希望它在 bash 脚本中工作。
错误是:
./upload.sh: line 12: syntax error near unexpected token ENE=$( grep UUID fstab | awk '/ext4/ {print $1}' | awk '{print substr($0,6)}'
)'
./upload.sh: line 12: ENE=$( grep UUID fstab | awk '/ext4/ {print $1}' | awk '{print substr($0,6)}'
)'