You might consider using an array for the args, something like this:
args=( "$f1" "$f2" )
ls "${args[@]}"
(The problem you’re hitting at the moment is that once interpolation has happened there’s no difference between intra- and inter- filename spaces.)
More Related Contents:
- Expansion of variables inside single quotes in a command in Bash
- How to execute a bash command stored as a string with quotes and asterisk [duplicate]
- Capturing multiple line output into a Bash variable
- Brace expansion with variable? [duplicate]
- Bash – variable variables [duplicate]
- Set environment variables from file of key/value pairs
- How can I escape a double quote inside double quotes?
- Which characters need to be escaped when using Bash?
- How to avoid heredoc expanding variables? [duplicate]
- How do I escape the wildcard/asterisk character in bash?
- Using variables inside a bash heredoc
- How to remove a newline from a string in Bash
- How to keep quotes in Bash arguments? [duplicate]
- How do I pass in the asterisk character ‘*’ in bash as arguments to my C program?
- Parsing variables from config file in Bash
- How does the leading dollar sign affect single quotes in Bash?
- Bash variables with spaces
- Is it possible to build variable names from other variables in bash? [duplicate]
- Bash indirect variable referencing
- How to modify a global variable within a function in bash?
- bash background process modify global variable
- Bash script store command output into variable
- osascript using bash variable with a space
- sed replace with variable with multiple lines [duplicate]
- Expand variables in sed
- How to substitute quoted, multi-word strings as arguments?
- bash piping prevents global variable assignment
- escaping newlines in sed replacement string
- Left side of pipe is the subshell?
- Loop over array, preventing wildcard expansion (*)