I have a bash script like thisexport pipedargument=| sort -nls $pipedargumentBut it gives the errorls: |: No such file or directoryls: sort: No such file or directoryIt seems to be treating the contents of | sort -n as just an argument passed to ls. 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?
Using | pipe character from a $variable makes it treat as just another argument in bash; how to escape it?
bash;shell;pipe;quoting;variable