I have a bash script like this
export pipedargument="| sort -n" ls $pipedargument
But it gives the error
ls: |: No such file or directory ls: sort: No such file or directory
It seems to be treating the contents of
"| sort -n" as just an argument passed to
How can I escape it so that it's treated as a regular piped command?
I'm trying to conditionally set the
$pipedargument. I guess I could just conditionally execute different versions of the command but still wondering if there's a way to make this work like above?