meaning of sintaxis: var=$'value' ?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting meaning of sintaxis: var=$'value' ?
# 1  
Old 03-12-2008
meaning of sintaxis: var=$'value' ?

What is the efect to use the syntax like that:
Code:
var=$'value'

The result seems the same as
Code:
var=value

I was compare the result of 'env' and 'typeset' and I see that the same variable in 'env' presented as var=value, but in 'typeset' the same vars with the same value presented with $'..'.
What is that and why?

Is there any benefit to use that syntaxis?

Last edited by alex_5161; 05-30-2008 at 01:31 PM..
# 2  
Old 05-30-2008
I still have no any resolution on this question.
Does anybody has any idea regarding that syntaxis?
# 3  
Old 05-30-2008
What shell are you using ?
With bash, the display is in the form var='value' not var=$'value'

From bash man pages :
Quote:
Words of the form $'string' are treated specially. The word expands to string, with backslash-escaped charac-
ters replaced as specified by the ANSI C standard. Backslash escape sequences, if present, are decoded as fol-
lows:
\a alert (bell)
\b backspace
\e an escape character
\f form feed
\n new line
\r carriage return
\t horizontal tab
\v vertical tab
\\ backslash
\' single quote
\nnn the eight-bit character whose value is the octal value nnn (one to three digits)
\xHH the eight-bit character whose value is the hexadecimal value HH (one or two hex digits)
\cx a control-x character

The expanded result is single-quoted, as if the dollar sign had not been present.

A double-quoted string preceded by a dollar sign ($) will cause the string to be translated according to the
current locale. If the current locale is C or POSIX, the dollar sign is ignored. If the string is translated
and replaced, the replacement is double-quoted.
Jean-Pierre.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Meaning of /var/log/messages

I am getting a lot of message as follows in /var/log/message files as follows. messages.1:559:May 4 20:01:56 SERVER2 kernel: session_stat: sync=0 async=33 aretr=0 messages.1:560:May 4 20:02:42 SERVER2 kernel: session_stat: dev=fd:5 state=6 blksize=4096 mmapsize=262144 messages.1:561:May 4... (2 Replies)
Discussion started by: Anjan Ganguly
2 Replies

2. Shell Programming and Scripting

Transfer the logs being thrown into /var/log/messages into another file example /var/log/volumelog

I have been searching and reading about syslog. I would like to know how to Transfer the logs being thrown into /var/log/messages into another file example /var/log/volumelog. tail -f /var/log/messages dblogger: msg_to_dbrow: no logtype using missing dblogger: msg_to_dbrow_str: val ==... (2 Replies)
Discussion started by: kenshinhimura
2 Replies

3. Shell Programming and Scripting

Csh , how to set var value into new var, in short string concatenation

i try to find way to make string concatenation in csh ( sorry this is what i have ) so i found out i can't do : set string_buff = "" foreach line("`cat $source_dir/$f`") $string_buff = string_buff $line end how can i do string concatenation? (1 Reply)
Discussion started by: umen
1 Replies

4. Solaris

Difference between /var/log/syslog and /var/adm/messages

Hi, Is the contents in /var/log/syslog and /var/adm/messages are same?? Regards (3 Replies)
Discussion started by: vks47
3 Replies

5. Solaris

/var/adm & /var/sadm

what is the difference between tha /var/adm and /var/sadm files in solaris 10 Os please can any one respond quickly thanking you (2 Replies)
Discussion started by: wkbn86
2 Replies

6. UNIX for Dummies Questions & Answers

Difference between $var and ${var}

Hi I want to know what is the difference between $var and ${var}. :D I saw in few of the scripts examples.Somewhere people use $var and somewhere ${var}. Is there any difference between two ? :confused: Thanks (4 Replies)
Discussion started by: dashing201
4 Replies

7. Solaris

Lost /var/sadm/install/contents file and /var/sadm/pkg

Hello, I recently found that my /var/sadm/install/contents, ~/admin/default, /var/spool/patch and /var/spool/pkg files were empty. This broke the pkginfo, pkgchk and other package related tools. The pkgmap no longer points to where the applications have been installed. I have replaced the... (0 Replies)
Discussion started by: ronin42
0 Replies

8. Solaris

diff b/w /var/log/syslog and /var/adm/messages

hi sirs can u tell the difference between /var/log/syslogs and /var/adm/messages in my working place i am having two servers. in one servers messages file is empty and syslog file is going on increasing.. and in another servers message file is going on increasing but syslog file is... (2 Replies)
Discussion started by: tv.praveenkumar
2 Replies

9. Solaris

Sintaxis cron

Hi everyone I am a started in UNIX operator system. Do you know the correct sintaxis to do a cron? The cron must execute in specific hours and minutes How do I do that? For example. Asumming that I want to execute my command at 6:30 a.m., 7:30 a.m. and 8:56a.m. I know that for doing the... (1 Reply)
Discussion started by: erik_da
1 Replies

10. UNIX for Dummies Questions & Answers

Meaning of $var->{"@$row[0]"}=" "; ???

while (my $row = $sth->fetchrow_arrayref) { $var->{"@$row"}=" "; } Can anyone help me understanding above mentioned. i) As per my knowledge $row is taking ARRAY Refernce from the database ii) @$row is containing the value of 0th index of the array, testted the same. but I am not able... (0 Replies)
Discussion started by: jaigs_27
0 Replies
Login or Register to Ask a Question