Find the answer to your Linux question:
Results 1 to 2 of 2
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Quote a var in a quoted command

    Hello everybody !
    I'll do my best to explain my problem in english, I apologize if it's not perfect.

    message="Line 1
    Line 2
    Line 3"
    source upload_config.txt
    curl -s -b cookies -d "form_sent=1&req_message=$message&req_subject=$title&submit=Valider" $edit_url >> temp
    Don't mind the curl syntax.
    This code works, but newline are not created, the output is something like "line 1 line 2 line 3"
    I read that the problem is that I have to quote $message in the command, but if I do it, bash don't exec the end of the command.

    So I tried
    req_message=`echo "$message"`
    But the output stay on one line.

    Do the problem is really related with the quote ?
    How can I add a newline symbol ?

    Looking for idea, thanks !

  2. #2
    Just solved the problem.

    req_message=`echo -e "$message"`

Posting Permissions

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