So others have commented about the particulars of bash and shell quotes, etc. I wanted to suggest you take a look at ShellCheck [1,2] and BATS [3]. I have been doing syntax, lint, and acceptance testing for Puppet code for about a year...and love it... but I recently came across these and have been working to apply the same principles to my shell script projects. The sheer number of fringe bugs in my script that using shellcheck has lead me to clean up has been amazing. BATS is more complicated, but the principle is that you write tests that can assert that your script is working or not. So I made a project just to play with this stuff, if you want to check it out [4]. [1] http://shellcheck.net [2] https://github.com/koalaman/shellcheck [3] https://github.com/bats-core/bats-core [4] https://gitlab.com/salderma/bash-spec-test --Sean > > From: Jerry Geis <jerry.geis@xxxxxxxxx> > To: CentOS mailing list <centos@xxxxxxxxxx> > Cc: > Bcc: > Date: Thu, 16 May 2019 12:57:43 -0400 > Subject: bash off topic > I have a simple bash script it will take arguments from a file that has > quotes. > > my file arg.txt would be this > -lt "*.txt" > > my script file would be > LS_ARG=`cat arg.txt` > ls $LS_ARG > > it does not run properly: > sh -x ./arg.sh > ++ cat arg.txt > + LS_ARG='-lt "*.txt"' > + ls -lt '"*.txt"' > ls: cannot access "*.txt": No such file or directory > > > How do I resolve that ? If the quotes are not in my file it all works > fine. I think its because it looks like the extra single quotes it puts > around the "*.txt" - or - '"*.txt"' - how do I do this ? This is just a > short example of my larger need. > > Thanks, > > Jerry > > _______________________________________________ CentOS mailing list CentOS@xxxxxxxxxx https://lists.centos.org/mailman/listinfo/centos