Sponsored Content
Top Forums Shell Programming and Scripting Help with variable assignment Post 302474910 by rahul9909 on Friday 26th of November 2010 01:49:50 AM
Old 11-26-2010
Help with variable assignment

Hi,

In AIX I have a variable with , (coma) separated values assigned to it like shown below

var1=apple,boy,chris
i want to convert this to
var1='apple','boy','chris'

the number of values assigned to var1 might change and it could be from 1 to n

any suggestions please?
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

@ in a variable assignment

Hello Everybody, Does anyone know what the @ symbol means in a csh script, if used with a variable assignment as below @ line = 1 why not just use.... set line=1 Many thanks rkap (1 Reply)
Discussion started by: rkap
1 Replies

2. Shell Programming and Scripting

variable assignment in new shell

Hi, I'm writing a KSH script, and at one point, I have to call a new shell and perform some variable assignments. I noticed that the assignment is not working. Please see two samples below: Command 1: #>ksh "i=2;echo I is $i" Output: #>I is Command 2: #>ksh <<EOF > i=2 > echo I... (7 Replies)
Discussion started by: maverick80
7 Replies

3. Shell Programming and Scripting

Dynamic variable assignment

Hi all, I’m very new to UNIX programming. I have a question on dynamic variable 1. I’m having delimited file (only one row). First of all, I want to count number of columns based on delimiter. Then I want to create number of variables equal to number of fields. Say number of... (5 Replies)
Discussion started by: mkarthykeyan
5 Replies

4. Shell Programming and Scripting

Complex variable assignment

Hi, I have a requirement as follows, need to call the format of ${$var} form. For example, i am taking a variable. count=1, ((LIMIT_$count=$count + 1)) Now i have to echo this variable LIMIT_$count. (This is in a loop..) echo ${LIMIT_$count} - displays as a syntax... (3 Replies)
Discussion started by: abhisheksunkari
3 Replies

5. Shell Programming and Scripting

variable assignment problem

hi everyone pls pls help in the query below it's urgent pls -bash-3.00$ abc=deepak -bash-3.00$ a=1 -bash-3.00$ def_${a}=$abc -bash: def_1=deepak: command not found y iti is giving error ? (3 Replies)
Discussion started by: aishsimplesweet
3 Replies

6. UNIX for Dummies Questions & Answers

Regex and variable assignment

Hi there, I really didn't want to have to waste people's time and ask this, but after 2 hours and running out of my own time I've decided to ask.. Basically I have a file in the format: word: other words; more words here; last word word: more words here; last word (etc) x 100 Where the... (3 Replies)
Discussion started by: maximus73
3 Replies

7. Shell Programming and Scripting

'eval' used in variable assignment

pattern1=book { x=1 eval echo \$pattern$x } book (this is the output) But when I assign a variable to the output of the eval it doesn't work unless I prefix 2 times backslash before $ as shown below. { a=`eval echo \\$pattern$x` echo $a } book Why here twice "\" has to be... (3 Replies)
Discussion started by: ravisingh
3 Replies

8. Shell Programming and Scripting

Usage of # in assignment of variable

guys, i would like to know what does the below does. tr=`echo $bfile | cut -d"." -f4` tr=${tr#TR} i tried with assigning a value and executed second line. but after that also value of tr remains same. thanks in advance .. (1 Reply)
Discussion started by: expert
1 Replies

9. Shell Programming and Scripting

Same Variable Assignment

Hi I have a strange problem: In my shell script I am performing a copy task: . prop.txt cp -r $dir/ $dir/archive $dir is fetched from a property file (prop.txt) which stores its value dir=/opt/data Now the problem is another dir1 comes into picture. I only want to add... (1 Reply)
Discussion started by: ankur328
1 Replies

10. Shell Programming and Scripting

Variable Assignment

Hi I am facing a problem. export local_folder=/opt/app/ cd /opt/app/abc/ abcversion="abc*" (abcga5 is inside /opt/app/abc/) echo $abcversion (it echoes the correct version as abcga5 ) Now when I reuse the value of abcversion for a below path: export... (6 Replies)
Discussion started by: ankur328
6 Replies
XATTR(1)						    BSD General Commands Manual 						  XATTR(1)

NAME
xattr -- display and manipulate extended attributes SYNOPSIS
xattr [-lrsvx] file ... xattr -p [-lrsvx] attr_name file ... xattr -w [-rsx] attr_name attr_value file ... xattr -d [-rsv] attr_name file ... xattr -c [-rsv] file ... xattr -h | --help DESCRIPTION
The xattr command can be used to display, modify or remove the extended attributes of one or more files, including directories and symbolic links. Extended attributes are arbitrary metadata stored with a file, but separate from the filesystem attributes (such as modification time or file size). The metadata is often a null-terminated UTF-8 string, but can also be arbitrary binary data. One or more files may be specified on the command line. For the first two forms of the command, when there are more than one file, the file name is displayed along with the actual results. When only one file is specified, the display of the file name is usually suppressed (unless the -v option described below, is also specified). In the first form of the command (without any other mode option specified), the names of all extended attributes are listed. Attribute names can also be displayed using ``ls -l@''. In the second form, using the -p option (``print''), the value associated with the given attribute name is displayed. Attribute values are usually displayed as strings. However, if nils are detected in the data, the value is displayed in a hexadecimal representation. The third form, with the -w option (``write''), causes the given attribute name to be assigned the given value. The fourth form, with the -d option (``delete''), causes the given attribute name (and associated value), to be removed. In the fifth form, with the -c option (``clear''), causes all attributes (including their associated values), to be removed. Finally, the last form, with either the -h or --help option, displays a short help message and exits immediately. OPTIONS
-l By default, the first two command forms either displays just the attribute names or values, respectively. The -l option causes both the attribute names and corresponding values to be displayed. For hexadecimal display of values, the output is preceeded with the hexadeci- mal offset values and followed by ASCII display, enclosed by ``|''. -r If a file argument is a directory, act as if the entire contents of the directory recursively were also specified (so that every file in the directory tree is acted upon). -s If a file argument is a symbolic link, act on the symbolic link itself, rather than the file that the symbolic link points at. -v Force the the file name to be displayed, even for a single file. -x Force the attribute value to be displayed in the hexadecimal representation. The -w option normally assumes the input attribute value is a string. Specifying the -x option causes xattr to expect the input in hexa- decimal (whitespace is ignored). The xxd(1) command can be used to create hexadecimal representations from exising binary data, to pass to xattr. EXIT STATUS
The xattr command exits with zero status on success. On error, non-zero is returned, and an error message is printed to the standard error. For system call errors, both the error code and error string are printed (see getxattr(2), listxattr(2), removexattr(2) and setxattr(2) for a complete list of possible error codes). Some attribute data may have a fixed length that is enforced by the system. For example, % xattr -w com.apple.FinderInfo 0 foo xattr: [Errno 34] Result too large: 'foo' The com.apple.FinderInfo attribute must be 32 bytes in length. EXAMPLES
This example copies the com.apple.FinderInfo attribute from the /usr directory to the MyDir directory: % xattr -px com.apple.FinderInfo /usr 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 % xattr -l MyDir % xattr -wx com.apple.FinderInfo "`xattr -px com.apple.FinderInfo /usr`" MyDir % xattr -l MyDir com.apple.FinderInfo: 00000000 00 00 00 00 00 00 00 00 40 00 00 00 00 00 00 00 |........@.......| 00000010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................| 00000020 SEE ALSO
ls(1), xxd(1), getxattr(2), listxattr(2), removexattr(2), setxattr(2) BSD
Nov 29, 2010 BSD
All times are GMT -4. The time now is 12:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy