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

    Escape Character needed for =

    I have the following code (in KSH)

    var1=`print $sentence | cut -f1 -d","`
    while [[ -n "${var1}" ]] #true if string length is not equal to zero
    	var1=`print $sentence | cut -f$j -d","`
    	newvar=$newvar" eg="$var1
    	let j=j+1
    echo $newvar
    The problem with this is, when I echo $newvar, the concatenated string must hold something like eg=abc eg=def eg=rtr

    But it prints eg abc eg def eg rtr

    The '=' symbol is not printed

    I tried various escape methods like \ '' ``, nothing seems to work. I feel I am missing something here.

    Could someone point the mistake in the code?

    In the meantime, if I figure it out, I will post it.

  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Nottingham, England
    Use the single-quote mark ' around such text, that should fix it (not the ` quote, but the ' quote).
    Linux user #126863 - see

  3. #3
    Thanks Roxoff for the reply,

    The problem was the I had a IFS="=" in the starting of the code to strip strings from a file.

    That had bothered this loop. (weird!, as I dont read anything)

    Thus I used a differnet IFS hust before that and ran it.

  4. $spacer_open

Posting Permissions

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