Sponsored Content
Full Discussion: Variable variables
Top Forums Shell Programming and Scripting Variable variables Post 302790471 by franzpizzo on Friday 5th of April 2013 12:12:19 PM
Old 04-05-2013
@Corona688 it's fantastic:
Code:
DAY=$1
MONTH_MONDAY_YEAR="1 2 3 4"
STR="MONTH_${DAY}_YEAR"
for i in ${!STR}
do
echo ${i}
done

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

extract from string variable into new variables

I have a variable which consists of a string like this: 001 aaabc 44 a bbb12 How do I extract each substring, delimited by the spaces, into new variables - one for each substring? eg var1 will be 001, var2 will be aaabc, var3 will be 44, var4 will be a, etc? I've come up with this:... (2 Replies)
Discussion started by: Sniper Pixie
2 Replies

2. Shell Programming and Scripting

how to seperate a variable in 2 variables

Dear all, i dont know how to split one variable value in 2 variable. please send me any example. variable1= "abcde developer" now i want to seperate the values and seperator is space. (6 Replies)
Discussion started by: intikhabalam
6 Replies

3. Shell Programming and Scripting

moving variables to another variable as a new avriable

Somehow I can't get it for this basic bash problem. maybe someone can help. What I try to do is: a="world" b="hello" how can I move this into $c so that I can replace "helloworld" with "world hello" in sed like: sed "s/\helloworld/ ${c}... I tried several combinations but all with... (4 Replies)
Discussion started by: lowmaster
4 Replies

4. Shell Programming and Scripting

Bash:How to split one string variable in two variables?

Hello, I have a paramter $param consisting just of two literals and want to split it into two parameters, so I can combine it to a new parameter <char1><string><char2>, but the following code didn't work: tmp_PARAM_1=cut -c1 $PARAM tmp_PARAM_2=cut -c2 $PARAM... (2 Replies)
Discussion started by: ABE2202
2 Replies

5. Shell Programming and Scripting

Combining multiple variables into new variable

Hello, I am a new joiner to the forum, and have what i hope is a simple question, however I can't seem to find the answer so maybe it is not available within bash scripting. I intend to use the below script to archive files from multiple directories at once by using a loop, and a variable (n)... (10 Replies)
Discussion started by: dring
10 Replies

6. Shell Programming and Scripting

Refering to compound variables with a variable name

Hello, Here is my problem using KSH I have a set of compound variables, let say cmp_var1 cmp_var2 The names of these variables are stored in an indexed array. How can I access the subfields of these compound variables ? I tried: set -A cmp_varnames=(cmp_var1 cmp_var2) for cmp in... (4 Replies)
Discussion started by: luky55
4 Replies

7. Shell Programming and Scripting

How to set a variable name from another variables value?

Experts, I want to set value of variables like this in bash shell: i=5 ; L=100 I want variable d5 (that is d(i) ) to be assign the value of $L , d$i=$L ; echo $d5 Not working Thanks., (3 Replies)
Discussion started by: rveri
3 Replies

8. Shell Programming and Scripting

Setting a variable using variables in a loop

Hi, I am having a bit of trouble with the below code: file=/path/to/file for i in 03 06 07 21; do if ; then eval count$i=`grep -c word $file-$i` fi done Totalcount=0 for i in 03 06 07 21; do if ; then echo $count$i variable not exist; else Tcount=`expr $Tcount + $count$i`; fi... (3 Replies)
Discussion started by: brunlea
3 Replies

9. Shell Programming and Scripting

Concatenate two variables and form the third variable

Hi Guys, I was scratching my head for this for half a day... finally not successful :confused: Following is the problem I have a variable $ var1=123 $ var2-234 $ var3=345 and another Variable $ i=1 Now i wanted to save these into a Variable as shown below for i in 1 2 3 do... (5 Replies)
Discussion started by: ramprabhum
5 Replies

10. UNIX for Beginners Questions & Answers

Expand Variables and Wildcards into another variable.

Dear Forum members, I am having trouble getting the complete filename (and directory path) in a variable. Output directory mentioned in the code have three files: DISPLAY_CITY_DETAILS_15-05-2019-08-29-26_MIGRATE_london.out DISPLAY_CITY_DETAILS_15-05-2019-08-29-26_MIGRATE_paris.out... (4 Replies)
Discussion started by: chetanojha
4 Replies
gozer(1)						      General Commands Manual							  gozer(1)

NAME
gozer - a commandline text renderer SYNOPSIS
gozer [options] [file] DESCRIPTION
gozer is a commandline text rendering utility for creating images from abitrary text in antialised truetype fonts using optional fontstyles, wordwrapping and layout control. gozer uses the imlib2 library to create and save images. gozer has a few options, detailed below. Specify [file] as the filename to save the rendered text to. Options can also be specified in an rc file , allowing you to save com- monly used options (such as fontpaths) for reuse. The rc file $HOME/.gozerrc is always parsed for default settings, and other rc files can be specified on the commandline to override these options. See RC FILES for information on syntax. OPTIONS
-h, --help display help output and exit. -v, --version output version information and exit. -b, --background COL use COL as the background color, see COLOUR_DEFINITIONS for syntax, default is transparent (0,0,0,0). -f, --foreground COL use COL as the foreground color. Default is white (255,255,255,255). -F, --font STR draw using font STR. Size is specified with the name, eg 'arial/12' for 12pt arial, default is 20thcent/16 (a font supplied by gozer). -j, --justification STR justify text, allowed values for STR are left, right, center or block. Default is left. -l, --line-spacing INT separate multiple lines by INT pixels, default 1. -p, --fontpath STR colon seperated list of font directories to search for fonts in. Best used in the RCFILE to save typing it each time. -q, --quality INT 1-100, effects quality of output for certain formats, e.g. jpeg compression (higher means higher quality). -P, --pipe Pipe input text from standard in instead of reading it from a file. -r, --rc-file STR use STR as the rc file to look for extra options, default is $HOME/.gozerrc -s, --style STR use STR as a file to load a fontstyle from, see FONTSTYLES for syntax. -t, --text STR use STR as text to draw. -T, --textfile STR read text to draw from file STR. -w, --wrap INT wordwrap the text to INT pixels. -x, --x-offset INT Offset text horizontally from top left by INT pixels. -y, --y-offset INT Offset text vertically from top left by INT pixels. RC FILES
rc file syntax is simple. The '#' character at the start of a line denotes that the line is a comment, otherwise lines are started with the name of a long option from the commandline (without prefixing the --), some whitespace and the value of the option. E.g. fontpath /usr/share/truetype:/usr/local/share/truetype NOTE that options in a --rc-file specified rc file OVERRIDE those from the commandline, but the $HOME/.gozerrc file is always read first for default settings. COLOUR_DEFINITIONS You can define colours in 4 ways. Using the html style: #RRGGBB (in which case alpha defaults to 255), #RRGGBBAA, or an alternative style: r,g,b or r,g,b,a (no spaces between commas please). eg for white text, either use #ffffff, #ffffffff, "255,255,255" or "255,255,255,255". For red, #ff0000, #ff0000ff or "255,0,0" etc. FONTSTYLES
fontstyles can be defined in the EFM syntax (for compatibility only, these are not as powerful), or the recommended syntax defined here. The first line contains the line: #Style The second, an optional style name, #NAME mystyle There follows a list of layers. Each is described by this rule: RED GREEN BLUE ALPHA X_OFFSET Y_OFFSET The special values or 0,0,0,0 for red, green, blue and alpha specify the positioning of the actual text in it's selected colour. For example, the following style defines a very simple shadow for text: #Style #NAME shadow 0 0 0 128 -3 -3 0 0 0 0 0 0 BUGS
None known. LICENSE
Copyright Tom Gilbert 2000 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies of the Software, its documentation and marketing & publicity materials, and acknowledgment shall be given in the documentation, materials and software packages that this Software was used. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MER- CHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Email bugs and feature requests to <gozer_sucks@linuxbrit.co.uk> Oct 26, 2000 gozer(1)
All times are GMT -4. The time now is 01:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy