I'm having a problem with something I can't really figure out by myself. I've tried to do it with a for loop, but I'm pretty sure it won't work, if I'm not mistaken.
Basically, what I'm trying to do is test some variables and if any of them is not empty, add the values of these variables to the list. For example:
This does not work with a for loop, as you know. I know this can be done with an if conditional, but how do I deal if I have lots of sub* variables? An if conditional is not really recommended here, is it? Any suggestion how to do this in a simple way, if possible?
Now $mp4 should contain the value of each non-empty variable from sub1 up to sub10.
[[ -z ]] tests if something is of value zero. If it is, echo empty, if not append it to your variable. You have to use eval to construct the variable name.
This is a really messy solution. The next time you should use an array.
Below are three variables, which I want to pass into variable RESULT1
username1=userid
poihostname1=dellsys.com
port1=8080
How can I pass these variables into below code...
RESULT1=$((ssh -n username1@poihostname1 time /usr/sfw/bin/wget --user=sam --password=123 -O /dev/null -q... (4 Replies)
Sometimes it is handy to protect long scripts in C++.
The following syntax works fine for simple commands:
#define SHELLSCRIPT1 "\
#/bin/bash \n\
echo \"hello\" \n\
"
int main ()
{
cout <<system(SHELLSCRIPT1);
return 0;
}
Unfortunately for there are problems for:
1d arrays:... (10 Replies)
Hi All,
i have a requirement where i have to run a script with at least 25 arguements and position of arguements can also change. the unapropriate way is like below. can we achieve this in more good and precise way??
#!/bin/ksh
##script is sample.ksh
age=$1
gender=$2
class=$3
.
.
.... (3 Replies)
Hi Friends ,
I got struck in below scenario. Require help to get the desired output.
I was going to other blog "Need help on appending all the lines in a file after a pattern is found." but
was not able to make with respect to my requirement.
Output Getting : --
Storage Group Name: ... (5 Replies)
I have two files
FILEA
a/b/c/d
e/f/g/h
i/j/k/l
m/n/o/p
FILEB
i/j/k/l
i want that if lines of FILEB matches lines of FILEA then matching lines in FILEA to be appended by word "MATCH"
NEW FILEA
a/b/c/d
e/f/g/h
i/j/k/l "MATCH"
m/n/o/p
I have tried following script .but not... (6 Replies)
HI,
Can't seem to find anything on the forums to fix this.
I have a file, one line within this will not have a specific string at the end.
I have the string, but need to append it to the specific line which has it missing.
I need to use a variable for this, $string - I am using double... (13 Replies)
Hello everybody,
I am having problem in converting byte array variables to Hexa String variables for Linux. I have done, converting byte array variables to Hexa String variables for Windows but same function doesn't work for linux. Is there any difference in OS ? The code for Windows is given... (2 Replies)
i've been fiddling around with append and I know how to append a word into a file, but how would you go about appending a word to a filename? (5 Replies)