Article 6MDF7 how to escape $ (dollar sign) when echoing environment variable

how to escape $ (dollar sign) when echoing environment variable

by
mfoley
from LinuxQuestions.org on (#6MDF7)
I am looping through a list of files:
Code:#!/bin/bash
cat fileList | while read
do
ls "$REPLY"
doneThe problem is that some of the files have '$' signs, e.g. "dir/$this file". echo, and printf attempt to expand $this as an environment variable giving "dir/ file" which of course the ls command doesn't find.

Is there a way to preserve the '$'? I probably need to change that to "dir/\$this file". How can I do that?
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments