Find the answer to your Linux question:
Results 1 to 2 of 2
I am trying to get quotes around a variable to make is just like I typed it in the terminal to get this script to work. it shows " quotes ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Nov 2013
    Posts
    20

    how do I set quotes around a variable so that the programs sees them..


    I am trying to get quotes around a variable to make is just like I typed it in the terminal
    to get this script to work. it shows " quotes around the varibale "
    but still does not see it as quotes, as far as I can figure out because it does not work.

    Code:
        hs='#'
    	echo ${hs}${hex}
    	echo  "\" #${hex} \""
    	echo  "\"#${hex}\""
    	#one way trying
    	hsetroot -solid "\"${hs}${hex}\""
    	#another way of trying
    	hsetroot -solid "\""${hs}${hex}"\""
    either way I put the " qoutes " around the variable, as you can see they both come up with quotes on both sides, and it still does not work. Yet if I type the "#31064d" into the terminal putting it where it needs to be then it works.
    output:
    Code:
     #31064d
     " #31064d "
     "#31064d"
     Bad color ("#31064d") 
     Bad color ("#31064d")
    this works it is a good color code
    Code:
    userx@bw2-crunchbang:~/testscript$ hsetroot -solid "#31064d"
    HOW do I format it in script so a program that needs the pram to be in quotes sees it in quotes?

    added:
    Code:
    	echo "\""#${hex}"\""
    	hsetroot -solid "\"#${hex}\""
    output:
    Code:
    Bad color ("#12eba5")
    you see the " quotes " are still added around the numbers and letters like typing it into the terminal yet I get a nope, not working.

    I've tried the ' ' and the ` ` marks too, no go.
    Last edited by userx-bw; 12-17-2013 at 12:42 AM.

  2. #2
    Just Joined!
    Join Date
    Nov 2013
    Posts
    20
    I figured it out
    Code:
    hsetroot -solid "#"${hex}""

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •