I have one-line that I want to call using alias.
while printf '%s ' "$(df -P / | awk 'NR==2 { print $(NF-1) }')"; do sleep 30; done
I tried to escape '
like \'
but it didn't work.
What is the correct syntax to use above one-liner in alias?
aliasescape-charactersquotingshell-script
I have one-line that I want to call using alias.
while printf '%s ' "$(df -P / | awk 'NR==2 { print $(NF-1) }')"; do sleep 30; done
I tried to escape '
like \'
but it didn't work.
What is the correct syntax to use above one-liner in alias?
Best Answer
You can check the result with
If
$()
is quoted by"
instead of'
or\
then it is substituted and the result rather than the intended program call becomes part of the alias definition.