bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

quotes in bash script


From: gscantlen
Subject: quotes in bash script
Date: Fri, 12 Jul 2013 18:48:27 +0000 (UTC)

I want a script to execute the command: 
ls -alst "dir with spaces" 


The script looks like this : 
#! /bin/bash 

PARAMS_FOR_LS="-alst \"dir with spaces\"" 

echo $PARAMS_FOR_LS 

ls $PARAMS_FOR_LS 



when I execute the script: 
bash -x script.sh 


I get: 
+ PARAMS_FOR_LS='-alst "dir with spaces"' 
+ echo -alst '"dir' with 'spaces"' 
-alst "dir with spaces" 
+ ls -alst '"dir' with 'spaces"' 
ls: cannot access "dir: No such file or directory 
ls: cannot access with: No such file or directory 
ls: cannot access spaces": No such file or directory 

why the extra quotes ?? 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]