The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
reading password and echoing '*' character on console hari_uctech HP-UX 1 06-10-2009 11:34 AM
Echoing Okema Shell Programming and Scripting 3 03-12-2008 11:33 PM
echo not echoing correctly shorty UNIX for Dummies Questions & Answers 3 09-25-2006 05:45 PM
echoing two variables in one statement wxornot Shell Programming and Scripting 4 05-10-2006 12:57 PM
Echoing remote user activity? dangerousbeans UNIX for Advanced & Expert Users 1 07-21-2004 01:48 AM

Reply
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 4 Weeks Ago
ahmad.diab's Avatar
ahmad.diab ahmad.diab is offline
Registered User
  
 

Join Date: May 2008
Location: Amman Jordan in MEA
Posts: 250
Echoing weird variables.

kindly find below:-


Code:
var="'(]\\{}\$\""
echo $var         #  it wil give this  '(]\{}$"
echo "$var"       # '(]\{}$" Doesn't make a difference why???.


if we set IFS to '\' also the below happens
IFS='\'
echo $var          # '(] {}$"        \ converted to space. Why? weird!!
echo "$var"        # '(]\{}$"

Can any one explain the above.

BR
  #2 (permalink)  
Old 4 Weeks Ago
jsmithstl jsmithstl is offline
Registered User
  
 

Join Date: Oct 2009
Location: St. Louis, MO
Posts: 75
What are you expecting it to return?
  #3 (permalink)  
Old 4 Weeks Ago
ahmad.diab's Avatar
ahmad.diab ahmad.diab is offline
Registered User
  
 

Join Date: May 2008
Location: Amman Jordan in MEA
Posts: 250
Quote:
Originally Posted by jsmithstl View Post
What are you expecting it to return?


Code:
IFS='\'
echo $var          # '(] {}$"
echo "$var"        # '(]\{}$"

expected  o/p is
'(]\\{}\$\"

  #4 (permalink)  
Old 4 Weeks Ago
jsmithstl jsmithstl is offline
Registered User
  
 

Join Date: Oct 2009
Location: St. Louis, MO
Posts: 75
Not sure if this helps, but I tried various ways to set IFS=\ with no luck. To get the output you're looking for I did:

var=\'\(]\\\\\\{}\$\\\"

echo $var

'(]\\{}$\"
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:00 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0