Sponsored Content
Full Discussion: match and assign variables
Top Forums Shell Programming and Scripting match and assign variables Post 302552529 by yazu on Sunday 4th of September 2011 09:06:13 AM
Old 09-04-2011
Code:
$ a='a b c'
$ b='1 2 3'
$ set -- $a
$ for x in $b; do
>   echo "$1 $x"
>   shift
> done
a 1
b 2
c 3

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Assign variables with cut

I need to read a file (a list) and assign the value to a variable (for each line), I'm looping until the end of the file. My problem is, I want to assign 2 separate variables from the list. The process I'm using is: awk '{print $3}' file1 > file2 awk '{print $4}' file1 > file3 cat file2... (2 Replies)
Discussion started by: douknownam
2 Replies

2. Programming

how do u assign the values to different variables when it is presneted in one line??

hey people.. i have a configuration file that looks like 7080 7988 net04.xxxxx.edu 20 where 20 is the number of threads in the thread pool initially. net04.xxxxx.edu is the hostname. and 7080 7988 are two ports. first one for client requests and second one for dns communication. now my... (2 Replies)
Discussion started by: SwetaShah
2 Replies

3. Shell Programming and Scripting

Assign script parameters to variables

Hi, I have a bash script that accepts some parameters as input, like: sh script.sh first second third ..... I want to save these parameters as different variables, something like: VAR1=first VAR2=second etc I tried this, but apparently it didn't worked....... (16 Replies)
Discussion started by: giorgos193
16 Replies

4. Shell Programming and Scripting

How do I assign values to variables made in a script?

How do I assign values to variables made in a script? e.g. for ((x=0;x<=5;i+=1)); do Xm$i=$var done (0 Replies)
Discussion started by: gelitini
0 Replies

5. Shell Programming and Scripting

Assign Values to variables from a text file

The text file has one single row and looks like this Q1 P1 2006 I have to pick up this values from a shell script into three different variables, say quarter, period and year from the above text file. Some one know's how to do this? I went through 'sed', dint really know how to... (3 Replies)
Discussion started by: sarsani
3 Replies

6. Shell Programming and Scripting

Assign values to variables of a file

Hi, I have a file like the following... CUST= DIR= NULIST= name=philps_123 How can i add values to each of these unassigned variables using a shell script? say for eg: i have values for CUST as onida, dir as /dir/onida, NULIST as /tmp/onida_files. How can i add these values to... (11 Replies)
Discussion started by: Tuxidow
11 Replies

7. Shell Programming and Scripting

Assign value to external variables from awk

Hello I have a text file with the next pattern Name,Year,Grade1,Grade2,Grade3 Name,Year,Grade1,Grade2,Grade3 Name,Year,Grade1,Grade2,Grade3 I want to assign to external variables the grades using the awk method. After i read the file line by line in order to get the grades i use this ... (2 Replies)
Discussion started by: Spleshmen
2 Replies

8. Shell Programming and Scripting

Assign grep match to variable question

Hi, I'm trying to assign a grep result to a variable but instead of having all grep result's assigned to the variable, would it be possible to assign the first match, do something, then move onto the next match and assign it to that variable and so on until all matches have been completed I... (4 Replies)
Discussion started by: Jazmania
4 Replies

9. Shell Programming and Scripting

A better way to assign values to variables - shell

so i've been used to doing it this way: SVAL=$(echo "7 3 2 38 3" | awk '{print $2}') 4VAL=$(echo "4:21:N:3" | awk -F":" '{print $4}') I know there's a way to do it by putting the value in an array and assigning it that way. but i'm not sure how to do it efficiently. any ideas? i dont... (9 Replies)
Discussion started by: SkySmart
9 Replies

10. Shell Programming and Scripting

Assign Unknown Values to Variables

i have a program that spits out a certain number of values. i dont know the number of values. they can be 4, 10, 7, 20, no idea. but, i want to be able to assign each of the value returned by this program to a variable. in the latest instance, the program gave the following 6 values: 4... (8 Replies)
Discussion started by: SkySmart
8 Replies
SCHROOT-SCRIPT-CONFIG(5)					   Debian sbuild					  SCHROOT-SCRIPT-CONFIG(5)

NAME
schroot-script-config - schroot chroot setup script configuration DESCRIPTION
schroot uses scripts to set up and then clean up the chroot environment. These scripts may be customised using the script-config key in /etc/schroot/schroot.conf. This key specifies a file which the setup scripts will source when they are run. The file is a Bourne shell script, and in consequence may contain any valid shell code, in addition to simple variable assignments. This will, for example, allow be- haviour to be customised according to the specific chroot type or name. This file is deprecated, but is still used if present; it will be obsoleted and removed in a future release. All the settings in this file are now settable using configuration keys in schroot.conf, as detailed below. Existing configuration should be modified to use these keys in place of this file. ENVIRONMENT
The environment is the same as for all setup scripts, described in schroot-setup(5). VARIABLES
The following variables may be set to configure setup script behaviour. Note that new variables may be added in future releases. Third- party extensions to schroot which add their own setup scripts may add additional variables which are not documented here; consult the extension documentation for further details. SETUP_COPYFILES A file containing a list of files to copy into the chroot (one file per line). The file will have the same absolute location inside the chroot. Note that this is settable using the setup.copyfiles key. SETUP_FSTAB The filesystem table file to be used to mount filesystems within the chroot. The format of this file is the same as for /etc/fstab, documented in fstab(5). The only difference is that the mountpoint path fs_dir is relative to the chroot, rather than the root. Note that this is settable using the setup.fstab key. Also note that mountpoints are canonicalised on the host, which will ensure that absolute symlinks point inside the chroot, but complex paths containing multiple symlinks may be resolved incorrectly; it is advised to not use nested symlinks as mountpoints. SETUP_NSSDATABASES A file listing the system databases to copy into the chroot. The default databases are 'passwd', 'shadow', 'group', 'services', 'protocols', 'networks', and 'hosts'. 'gshadow' is not yet copied by default, due to not being supported by all but the most recent version of the GNU C library. The databases are copied using getent(1) so all database sources listed in /etc/nsswitch.conf will be used for each database. Note that this is settable using the setup.nssdatabases key. AUTHORS
Roger Leigh. COPYRIGHT
Copyright (C) 2005-2012 Roger Leigh <rleigh@debian.org> schroot is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. SEE ALSO
sbuild(1), schroot(1), sh(1), schroot.conf(5), schroot-setup(5). Version 1.6.4 27 Oct 2012 SCHROOT-SCRIPT-CONFIG(5)
All times are GMT -4. The time now is 08:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy