Sponsored Content
Full Discussion: Eval set -- and more
Top Forums UNIX for Beginners Questions & Answers Eval set -- and more Post 302990823 by Corona688 on Wednesday 1st of February 2017 10:26:12 AM
Old 02-01-2017
-- "$@" just means, "take the following arguments literally" and "all the following arguments, properly separated and quoted". If your arguments are "a b" "c d" "e f", "$@" will put them in as "a b" "c d" "e f", not "a" "b" "c" "d" "e" "f".

The 'shift' eats a commandline argument, i.e. converts $1=a, $2=b, $3=c, $4=d into $1=b, $2=c, $3=d. shift 2 moves it all the way to $1=c, $2=d. It's done since that particular branch uses an argument, so it has to remove two things from the list (the -r and the argument following it) not just one.

I have no idea why they're doing 'eval set', only theories. That's dangerous and dumb. They may be trying to process quotes inside quotes.



They are getting the values from 'getopt', the standard way to handle commandline arguments. I can't really explain its workings, but I'm sure others can.

Last edited by Corona688; 02-01-2017 at 11:48 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

using eval with set, wc, and expr

Okay this is a mess, I'm trying to assign variables with variables in a for-loop. Here is what i have for code. The syntax is not good. Given the following script: #! /bin/csh foreach site (ABC DEF GHI) eval set \t$${site}sf = ``wc -l \$${site}.sf | awk '{print $1}'`` eval set... (2 Replies)
Discussion started by: wxornot
2 Replies

2. Shell Programming and Scripting

EVal

Hi All, I'm running some encrypted data through a script I wrote. In order to do this, I'm using eval to resolve some of my variables. At the moment, when I use eval to resolve, it strips out some of my encrypted values, and totally drops some others. For example if I have the value ab1"3 it drops... (1 Reply)
Discussion started by: Khoomfire
1 Replies

3. Shell Programming and Scripting

KSH script eval(?) to set variable

first of all, thanks to all on this board, it has been a huge resource to answer most of my questions! I am stuck on something that should really be simple, and was looking for some help.. I am using KSH on solaris and working on a script to move containers from server to server. Where i am... (4 Replies)
Discussion started by: tksol
4 Replies

4. Shell Programming and Scripting

eval help

I am trying to expand the variable $user in my alias command and tried several variations of eval but can't seem to get it to work. The end result should be either: oracle_user='sudo su - oracle ' or oracle_user='sudo su - oracle1 ' user=$(grep '^oracle:' /etc/passwd | cut... (5 Replies)
Discussion started by: BeefStu
5 Replies

5. Shell Programming and Scripting

eval

hi all, Am trying to add some code to a ksh script and i dont understand how an eval function is used : _var=$1 _conceal=$2 eval _val=\$${_var} can someone shed some light on what the eval function in the above context means/does ?? thanks. (4 Replies)
Discussion started by: cesarNZ
4 Replies

6. Shell Programming and Scripting

Strange result of eval, how does eval really work with ssh?

Hi all, some small script with eval turned me to crazy. my OS is linux Linux s10-1310 2.6.16.53-0.8.PTF.434477.3.TDC.0-smp #1 SMP Fri Aug 31 06:07:27 PDT 2007 x86_64 x86_64 x86_64 GNU/Linux below script works well #!/bin/bash eval ssh remotehost date eval ssh remotehost ls below... (1 Reply)
Discussion started by: summer_cherry
1 Replies

7. Shell Programming and Scripting

Error in eval eval command to print html tags

anyone has any info on why this is complaining??? vivek@vivek-c5e55ef2e ~/TAC $ zoneCounter=1 vivek@vivek-c5e55ef2e ~/TAC $ optUsage1=23% vivek@vivek-c5e55ef2e ~/TAC $ eval eval echo "<th>Zone $zoneCounter </th><th align=\"left\"> \$optUsage$zoneCounter </th>" -bash: syntax error... (1 Reply)
Discussion started by: vivek d r
1 Replies

8. Shell Programming and Scripting

Error in eval eval command to print html tags

anyone has any info on why this is complaining??? vivek@vivek-c5e55ef2e ~/TAC $ zoneCounter=1 vivek@vivek-c5e55ef2e ~/TAC $ optUsage1=23% vivek@vivek-c5e55ef2e ~/TAC $ eval eval echo "<th>Zone $zoneCounter </th><th align=\"left\"> \$optUsage$zoneCounter </th>" -bash: syntax error... (13 Replies)
Discussion started by: vivek d r
13 Replies

9. Shell Programming and Scripting

Eval

thank you (35 Replies)
Discussion started by: ratnalein88
35 Replies

10. Shell Programming and Scripting

Getopt eval set parameters not happening when the script is called through an application!

Hi, There is an Informatica tool through which unix scripts can be called. Now the requirement in my project is that a parent script calls a child script but this parent script has to be called through the Informatica tool. In Parent script I'm using TEMP=`getopt -o x:y: -l area:,volume:... (1 Reply)
Discussion started by: Panna
1 Replies
ADPLUGDB(1)							   User Commands						       ADPLUGDB(1)

NAME
adplugdb - AdPlug database maintenance utility SYNOPSIS
adplugdb [OPTION]... COMMAND [ARGUMENT]... DESCRIPTION
adplugdb maintains database files in AdPlug database format. It can add, list and remove records within a central database, or merge a set of databases together into one single database. adplugdb always operates on a central database file. The location of this database file is determined by first checking if the user has a home directory. If a home directory is present, the database file will be located in ~/.adplug/adplug.db. If a home directory is not present, a database file adplug.db will be looked for in the current working directory. A system-wide database file can be used instead, by specifying the -s commandline option. The system-wide database file is located in /usr/com/adplug/adplug.db and may only be manipulated as the superuser. An arbitrary database file might be used as well, by specifying the -d commandline parameter. Only one database file may be manipulated at a time. EXIT STATUS
adplugdb returns with a successful exit status (0 on most systems) on successful operation. An unsuccessful exit status (1 on most systems) is returned otherwise. COMMANDS
Commands control the main operation mode of adplugdb. Commands can have a number of arguments. Only one command may be specified at a time. add This command takes a list of filenames, separated by spaces, as arguments. Each file is examined and a record is added to the data- base if the file is supported by AdPlug. By default, the record will be of type Plain, unless the -t commandline option is specified (see below). The default comment entry is the specified filename. If a record for a file is already in the database, it will be replaced by the new record. list This command takes an optional list of filenames or keys, separated by spaces, as arguments. Each file is examined and the corre- sponding record is looked up from the database and displayed on stdout, in a human-readable form. If no arguments are given, all records from the database are displayed. remove This command takes a list of filenames or keys, separated by spaces, as arguments. Each file is examined and the corresponding record is removed from the database. merge This command takes a list of database filenames, separated by spaces, as arguments. Each database file is loaded and the contents are merged and written to the central database file. The database files are processed in the order they are specified on the comman- dline. Records from databases that were specified earlier take precedence over records from databases that were specified later. Records from the central database take precedence over all other records. This means that only additional records from the other databases will be added to the central database and if a record is found that is not already in the central database, the version from the earliest specified database that contains this record will be taken. In no way will records ever be overwritten in the cen- tral database. OPTIONS
The order of the option commandline parameters is not important. Database options: -d <file> Specify an arbitrary file to use as the central database. -s Use the system-wide database file as the central database. This option is only present if adplugdb was compiled with system-wide database file support. -t <type> Specify a record type to be used as the type for all newly added records. Each record needs a special type to be useful to AdPlug's players. The commandline help, displayed using the -h commandline option, presents a list of types that may be specified. -c Prompt for record comment. If this option is given, the user will be prompted and asked for each newly added record's comment. -k Specify keys instead of filenames. If this option is given, all command arguments that normally are filenames are expected to be record keys instead. Each record in the database has a unique identifying key, generated from the corresponding file's contents. To manipulate a record entry, you either must have the exact same file and specify its name, or you specify the record's key, using this option. Keys are specified the same way they are displayed using the list command, as CRC16:CRC32 value in hexadecimal format. Generic options: -q, --quiet Be more quiet. -v, --verbose Be more verbose. -h, --help Show summary of commandline commands, arguments and options. -V, --version Show version and author information of the program. AUTHOR
Simon Peter <dn.tlp@gmx.net> AdPlug database maintenance utility 2.2.1 March 4, 2006 ADPLUGDB(1)
All times are GMT -4. The time now is 06:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy