Sponsored Content
Top Forums Shell Programming and Scripting Variable within variable expansion Post 303044731 by hburnswell on Monday 2nd of March 2020 05:30:43 PM
Old 03-02-2020
@RudiC, much appreciated.

Your comment on this not being the best approach is not surprising ;-)... I continue to try and improve my efforts but due to my skill level, usually start with functionality. I will investigate your suggestion of associative arrays.

Any high level example of how to better do what I'm trying with associative arrays?

Thanks again..

HB
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

ksh on HP-UX -- variable expansion

We have a script that runs in ksh on HP-UX 11.11. It takes three arguments. The last argument can be a filename or wildcard character. For example: script -s hello -t goodbye '*.d*' In a case such as this, I would wrap single quotes around the final argument because I dont want the shell to... (4 Replies)
Discussion started by: dangral
4 Replies

2. Shell Programming and Scripting

Basic variable expansion not working...

#!/usr/bin/bash if then echo "Not valid arguments entered. Just username should be entered." else USER_NAME=$1 FILE_NAME=$USER_NAME.info UNN=STUDIN\\\\$1 echo $UNN last STUDIN\\\\$1 last UNN If I type `last STUDIN\\eip060` it works but if I try to expand it with variable it is... (5 Replies)
Discussion started by: Zammy_bg
5 Replies

3. Shell Programming and Scripting

bash - delay expansion of variable

Hello - I have a bash script which does some logging, and I'd like to include the line number of the echo statement that pipes into $LOGGER: MYPID=$$ MYNAME=`basename $0` LOGGER="/usr/bin/logger -t $MYNAME($LINENO) -p daemon.error" ... echo 'this is an entry into the log file' | $LOGGER ... (3 Replies)
Discussion started by: scandora
3 Replies

4. UNIX for Dummies Questions & Answers

Variable brace expansion

I'm in the habit of using the following type of loop structure: for num in `seq $1 $2` do command doneWhile `seq $1 $2` is not exactly a huge resource hog, I would like to learn a better way. It seems that brace expansion is a good way to go: for num in {3..10}The problem, though, is... (2 Replies)
Discussion started by: treesloth
2 Replies

5. Shell Programming and Scripting

Bash variable delayed expansion?

i write a batch file , here is the content. dirname='date +%Y-%m-%d' mkdir dirname but it doen's work, it just create a folder named date and +%Y-%m-%d. i have tried run the command seperately in the bash prompt. after the first sentence executed , i use $dirname to watch the value of... (4 Replies)
Discussion started by: premotheus
4 Replies

6. Shell Programming and Scripting

Variable expansion in sed

The objective of the code below is to create sed script to be later executed. However, it bonks because $ARCHIVENAME expands to a directory specification so the forward slashes cause problems. I can think of a few solutions that would involve redesigning the process, but I'm hoping there might be... (4 Replies)
Discussion started by: tiggyboo
4 Replies

7. Shell Programming and Scripting

delay variable expansion

Hi forum, in my bash script I've many lines executing commands with redirection to log files. ... xyz_cmd 2>&1 > $BASENAME.$LINENO The trailing part of these lines doesn't look nice and I like to put it into a variable. The (not working) idea is something like that ... (3 Replies)
Discussion started by: wolfi089
3 Replies

8. UNIX for Dummies Questions & Answers

Can I use a variable with brace expansion?

So, I was bored on the train today, and was thinking of ways to loop through elements of an array. I came up with the following simple script, but it doesn't work as brace expansion doesn't seem to work with variables. Is there something I'm missing, or does the shell just not work like this? ... (4 Replies)
Discussion started by: DeCoTwc
4 Replies

9. Shell Programming and Scripting

Help required regarding variable expansion in UNIX

Hello, I have one variable coming from one file: abc=$xyz/filename.txt where $xyz is defined in .profile file as say, /usr/dev/src i am passing abc variable to one perl script as input parameter. perl 123.pl -s $abc But inside the perl script execution, the variable $abc is just... (1 Reply)
Discussion started by: vikas_trl
1 Replies

10. Shell Programming and Scripting

Bash variable expansion

Hello. The file /etc/fstab contains UUID=957c3295-9944-1593-82e2-2b90dede4312 / ext4 noatime,discard,acl,user_xattr 1 1 I fill a variable SOME_LINE=$( cat /etc/fstab | grep \/\..*ext4 | grep noatime,discard )echo $SOME_LINE... (3 Replies)
Discussion started by: jcdole
3 Replies
__gnu_pbds(3cxx)														  __gnu_pbds(3cxx)

NAME
__gnu_pbds - SYNOPSIS
Classes struct associative_container_tag Basic associative-container. class basic_hash_table An abstract basic hash-based associative container. struct basic_hash_tag Basic hash. class basic_tree An abstract basic tree-like (tree, trie) associative container. struct basic_tree_tag Basic tree. struct binary_heap_tag Binary-heap (array-based). struct binomial_heap_tag Binomial-heap. class cc_hash_table A concrete collision-chaining hash-based associative container. struct cc_hash_tag Collision-chaining hash. class container_base An abstract basic associative container. struct container_tag Base data structure tag. struct container_traits container_traits class gp_hash_table A concrete general-probing hash-based associative container. struct gp_hash_tag General-probing hash. class list_update A list-update based associative container. struct list_update_tag List-update. struct null_mapped_type A mapped-policy indicating that an associative container is a set. struct ov_tree_tag Ordered-vector tree. struct pairing_heap_tag Pairing-heap. struct pat_trie_tag PATRICIA trie. struct priority_queue_tag Basic priority-queue. struct rb_tree_tag Red-black tree. struct rc_binomial_heap_tag Redundant-counter binomial-heap. struct sequence_tag Basic sequence. struct splay_tree_tag Splay tree. struct string_tag Basic string container, inclusive of strings, ropes, etc. struct thin_heap_tag Thin heap. class tree A concrete basic tree-based associative container. struct tree_tag tree. class trie A concrete basic trie-based associative container. struct trie_tag trie. Typedefs typedef void trivial_iterator_difference_type Functions void __throw_container_error (void) void __throw_insert_error (void) void __throw_join_error (void) void __throw_resize_error (void) Detailed Description GNU extensions for policy-based data structures for public use. Author Generated automatically by Doxygen for libstdc++ from the source code. libstdc++ Tue Nov 27 2012 __gnu_pbds(3cxx)
All times are GMT -4. The time now is 11:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy