i working on simple scripting project work involves use of bash. have pretty simple script following:
#!/bin/bash var1="$1" var2="$2" moref='sudo run command against $var1 | grep name | cut -c7-' echo $moref when run script command line , pass arguments, not getting output. however, when run commands contained within $moref variable, able output. know how 1 can take results of command needs run within script, save variable, , output variable on screen?
in addition backticks, can use $(), find easier read, , allows nesting.
output="$(ls -1)" echo "${output}" quoting (") matter preserve multi-line values.
Comments
Post a Comment