Sponsored Content
Top Forums UNIX for Advanced & Expert Users Variable assignments specified with eval shell built-in Post 302486417 by fpmurphy on Saturday 8th of January 2011 11:40:29 AM
Old 01-08-2011
Note that Bash even in POSIX mode is not fully POSIX compliant. It is mostly compliant. There are weasel words used to avoid claiming full compliance.
Quote:
will cause Bash to conform more closely to the POSIX standard
Chet R has no interest in full conformance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

eval a variable that has a .

Hi, Is there any way that I can eval the following - eval abc.csv=def.csv I am getting the - bash: command not found error. thanks. (3 Replies)
Discussion started by: ttshell
3 Replies

2. Shell Programming and Scripting

How to assign eval value as Variable..

Im facing problem in assigning value of eval array variable as normal variable.. x=0 eval DATA${x}="FJSVcpcu" x=`expr $x + 1` eval DATA${x}="FJSVcsr" if x=0, type -> eval echo \$DATA$x , its give me FJSVcpcu i want assign this value into an variable as variable=`eval echo... (3 Replies)
Discussion started by: neruppu
3 Replies

3. UNIX for Dummies Questions & Answers

built in variable to hold the name of therunning script...

Hi, I have multiple functions that can be called by any shell script. These functions have inbuilt echo statements to logs their activity into a log file. When I run multiple shell scripts that call these functions, they all log into the same log file and I am not able to differentiate which... (2 Replies)
Discussion started by: new_learner
2 Replies

4. Shell Programming and Scripting

Passing eval value to a variable

Hello, I have a script that does an scp to a server and then gets the number of process running on that server, the o/P should be stored in a variable for further processing eval `echo "ssh -q $Infa_user@$host 'csh -c $CMD '"` where CMD="ps -ef | grep -i ${INFA_REPO} | grep -v grep | wc... (2 Replies)
Discussion started by: amit1_x
2 Replies

5. Shell Programming and Scripting

eval and variable assignment

Hi, i have an issue with eval and variable assignment. 1) i have a date value in a variable and that date is part of a filename, var1=20100331 file1=${var1}-D1-0092.xml.zip file2=${var2}-D2-0092.xml.zip file3=${var3}-D3-0092.xml.zip i am passing the above variables to a script via... (11 Replies)
Discussion started by: mohanpadamata
11 Replies

6. Shell Programming and Scripting

assignment to variable from eval command

Hi Gurus, I am having 2 parameters as below parm1=value1 parm2=parm1 I want to evaluate parm1 value using eval echo \$$parm2 and later i want to assign this value to other variable which i will be using in if statement like : if ]; then do this....... fi could you please suggest... (5 Replies)
Discussion started by: k_vikash
5 Replies

7. Shell Programming and Scripting

awk built-in variable for input file

Hi guys, Does awk have a built-in variable which I can use to display the input file it's currently reading? I'm currently concatenating multiple files using awk and later on do some parsing. But for now, I want to add an extra column in the main output data file - basically putting in the... (3 Replies)
Discussion started by: Det7
3 Replies

8. Shell Programming and Scripting

Newline in my script-built shell variable

Hi all, I'm not exactly a shell script guru, so this is probably a very silly question and I'm not seeing the point, but you know, sometimes it happens... I have this script which adds entries to local arp cache using it to find the corresponding IP address. # export MAC=00:25:90:34:3d:f2... (16 Replies)
Discussion started by: micantox
16 Replies

9. 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

10. Shell Programming and Scripting

Safe way to eval variable declarations?

Is there a safe way to evaluate variable declarations within a script whether they come from a .conf file, user input, or stdin? Example .conf file: server=ftp.xxxx.com port=21 user="$USER" # Hopefully allow this type of substitution domain="$DOMAIN" server="$(malicious... (4 Replies)
Discussion started by: Michael Stora
4 Replies
COMPAT(5)						      BSD File Formats Manual							 COMPAT(5)

NAME
compat -- manipulate compatibility settings SYNOPSIS
COMMAND_MODE=legacy|unix2003 #define _POSIX_C_SOURCE #define _DARWIN_C_SOURCE #define _NONSTD_SOURCE defined(__LP64__) #include <sys/cdefs.h> defined(_DARWIN_FEATURE_UNIX_CONFORMANCE) DESCRIPTION
Setting the environment variable COMMAND_MODE to the value legacy causes utility programs to behave as closely to Mac OS X 10.3's utility programs as possible. When in this mode all of 10.3's flags are accepted, and in some cases extra flags are accepted, but no flags that were used in 10.3 will have been removed or changed in meaning. Any behavioral changes in this mode are documented in the LEGACY sections of the individual utilities. Setting the environment variable COMMAND_MODE to the value unix2003 causes utility programs to obey the Version 3 of the Single UNIX Specification (``SUSv3'') standards even if doing so would alter the behavior of flags used in 10.3. The value of COMMAND_MODE is case insensitive and if it is unset or set to something other than legacy or unix2003 it behaves as if it were set to unix2003. COMPILATION
Defining _NONSTD_SOURCE for i386 causes library and kernel calls to behave as closely to Mac OS X 10.3's library and kernel calls as possi- ble. Any behavioral changes are documented in the LEGACY sections of the man pages for the individual function calls. Defining this macro when compiling for any other architecture will result in a compilation error. Defining _POSIX_C_SOURCE or _DARWIN_C_SOURCE causes library and kernel calls to conform to the SUSv3 standards even if doing so would alter the behavior of functions used in 10.3. Defining _POSIX_C_SOURCE also removes functions, types, and other interfaces that are not part of SUSv3 from the normal C namespace, unless _DARWIN_C_SOURCE is also defined (i.e., _DARWIN_C_SOURCE is _POSIX_C_SOURCE with non-POSIX exten- sions). In any of these cases, the _DARWIN_FEATURE_UNIX_CONFORMANCE feature macro will be defined to the SUS conformance level (it is unde- fined otherwise). Starting in Mac OS X 10.5, if none of the macros _NONSTD_SOURCE, _POSIX_C_SOURCE or _DARWIN_C_SOURCE are defined, and the environment vari- able MACOSX_DEPLOYMENT_TARGET is either undefined or set to 10.5 or greater (or equivalently, the gcc(1) option -mmacosx-version-min is either not specified or set to 10.5 or greater), then UNIX conformance will be on by default, and non-POSIX extensions will also be available (this is the equivalent of defining _DARWIN_C_SOURCE). For version values less that 10.5, UNIX conformance will be off when targeting i386 (the equivalent of defining _NONSTD_SOURCE). In order to provide both legacy and conformance versions of functions, two versions of affected functions are provided. Legacy variants have symbol names with no suffix in order to maintain ABI compatibility. Conformance versions have a $UNIX2003 suffix appended to their symbol name. These $UNIX2003 suffixes are automatically appended by the compiler tool-chain and should not be used directly. Platforms that were released after these updates only have conformance variants available and do not have a $UNIX2003 suffix. i386 ------------------------------+-------------------------------------------- user defines deployment | namespace conformance suffix target | ------------------------------+-------------------------------------------- (none) < 10.5 | full 10.3 compatibility (none) (none) >= 10.5 | full SUSv3 conformance $UNIX2003 _NONSTD_SOURCE (any) | full 10.3 compatibility (none) _DARWIN_C_SOURCE < 10.4 | full 10.3 compatibility (none) _DARWIN_C_SOURCE >= 10.4 | full SUSv3 conformance $UNIX2003 _POSIX_C_SOURCE < 10.4 | strict 10.3 compatibility (none) _POSIX_C_SOURCE >= 10.4 | strict SUSv3 conformance $UNIX2003 ------------------------------+-------------------------------------------- Newer Architectures ------------------------------+-------------------------------------------- user defines deployment | namespace conformance suffix target | ------------------------------+-------------------------------------------- (none) (any) | full SUSv3 conformance (none) _NONSTD_SOURCE (any) | (error) _DARWIN_C_SOURCE (any) | full SUSv3 conformance (none) _POSIX_C_SOURCE (any) | strict SUSv3 conformance (none) ------------------------------+-------------------------------------------- STANDARDS
With COMMAND_MODE set to anything other than legacy, utility functions conform to Version 3 of the Single UNIX Specification (``SUSv3''). With _POSIX_C_SOURCE or _DARWIN_C_SOURCE for i386, or when building for any other architecture, system and library calls conform to Version 3 of the Single UNIX Specification (``SUSv3''). BUGS
Different parts of a program can be compiled with different compatibility settings. The resultant program will normally work as expected, for example a regex created by the SUSv3 regcomp(3) can be passed to the legacy regfree(3) with no unexpected results. Some cases are less clear cut, for example what does the programmer intend when they use the SUSv3 regcomp(3) to compile a regex, but the legacy regexec(3) to execute it? Any interpretation will surprise someone. Darwin June 30, 2010 Darwin
All times are GMT -4. The time now is 01:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy