using existing variables as counters in a "for" loop ?
Hi all,
I am rather new to shell programing
I am trying to run a loop through variables that already exist,
here is (a part of ) the code, variables param_kz etc already exist (in the same file, i do not run another script file etc) and have values assigned to them (strings, "y" or "n")
the echo $param_kz before the loop and after it is just to check if the (already existing) variable is what i set it to earlier in the code.
Seems in the loop it treats the param_${pw} as new variables, since echo $[param_${pw}] returns zeros (even though they are either "y" or "n").
The funny thing is that a similar construction works for a friend on his laptop. So, my question is, is there a way to do this the way i am trying, am i missing something, does the older version of bash somehow creates new variables in loops in this sense, or what ? I tried
, to no avail
Sure i can do it some other way, but it is annoying when you do not know why a seemingly good idea doesn't want to work ...
Thanks
Luk
Hello.
System : opensuse leap 42.3
I have a bash script that build a text file.
I would like the last command doing :
print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt
where :
print_cmd ::= some printing... (1 Reply)
Hi everybody,
I am new at Unix/Bourne shell scripting and with my youngest experiences, I will not become very old with it :o
My code:
#!/bin/sh
set -e
set -u
export IFS=
optl="Optl"
LOCSTORCLI="/opt/lsi/storcli/storcli"
($LOCSTORCLI /c0 /vall show | grep RAID | cut -d " "... (5 Replies)
How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address
and column 3 contains “cc” e-mail address to include with same email.
Sample input file, email.txt
Below is an sample code where... (2 Replies)
We have a 2 node cluster in which only the primary actually mounts the shared VGs at any specific time. We recently added a volume group to the primary.
* The disks in it are visible to both nodes, but the secondary does not know about the new VG.
* The new VG is not a "shared volume group"
*... (10 Replies)
Hi ,
can any one tell me,"How to extract the same format from existing excel file to new excel file " using Spreadsheet::WriteExcel or Spreadsheet::ParseExcel module ???
Example_pgm:
Below program is used to read existing excel file..In this program "my $cell = $_;" line is used to... (0 Replies)
Hi,
I have line in input file as below:
3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL
My expected output for line in the file must be :
"1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL"
Can someone... (7 Replies)
Hi.
I have a copy-file script (and a move-file script) that I recently tried to make interactive. I tested the former on three files from a text list, and watched to see what would happen. As the cp command was in a while/do/done loop, there was no pause for input: it wrote the file from the... (2 Replies)
both ksh/bash support this 2 special variables, Is there any document for reference?
1) "-" is $OLDPWD
2) "$_" is last argument of previous command. (4 Replies)
Hi Friends,
Can any of you explain me about the below line of code?
mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`
Im not able to understand, what exactly it is doing :confused:
Any help would be useful for me.
Lokesha (4 Replies)