Hi, I am trying to combine 2 strings into one new string. I know there are existing threads on this topic, but I am having troubles. The variables have variables within their names which is causing me problems. Bad subsitution is the error.
The problem line is in red below.
thanks (again) to... (1 Reply)
Hi All,
I have a problem assigning variables to script.I have a script in which i have a while loop now i have to assign some values obtained to an array which will be used later in the script.Can anyone help how to do that.
At present my scrot looks like:
co=0
pco=0
co=`cat /tmp/highcpu... (4 Replies)
Hi
I am new to shell scripting and i am preparing a script.
for now i am work on a sub part of it..but i am unable to make it work.
---
the test code that i am working on
--------------------------
IFS=""
Sample_eve=`psg proc_s | grep tY`
n=0
for line in $Sample_eve... (41 Replies)
Hi,
I'm trying to extract the middle of an array that is of
variable length but always has a first and last common
element,
The following works OK...
#!/bin/bash
ARRAY='switch'
ARRAY='option1'
ARRAY='option2'
ARRAY='option3'
ARRAY='value'
SWITCH=${ARRAY:0:1}
VALUE=${ARRAY:(-1)}... (1 Reply)
Hello everyone,
My problem looks quite simple , how to assign a string with spaces and lines "\n" to a variable.
I've tried all kind of quoting and is impossible, bash always try to execute the string and never executes a simple assignation.
This is part of the code
... (1 Reply)
Okay, I've made threads on extracting fields and comparing strings in separate files in .csv's. I've written the following code with intentions of learning more.
I just want this one question answered: How can I assign fields from a file(comma separated) to variables?
My goal is to check... (0 Replies)
if i declare both but don't input any variables what values will the int array and file pointer array have on default, and if i want to reset any of the elements of both arrays to default, should i just set it to 0 or NULL or what? (1 Reply)
echo "hello123" | tr -dc '' | wc -c
using this command i can count the no of times a number from 0-9 occurs in the string "hello123"
but how do i save this result inside a variable?
if i do
x= echo "hello123" | tr -dc '' | wc -c
that does not work...plz suggest..thanks (3 Replies)
Hi,
This is the first time I see something like this, and I don't why it happens.
Please give me some help. I am really appreciate it.
Basically I am trying to remove all empty lines of an input..
#!/bin/bash
set -e
set -x
str1=`echo -e "\nhaha" | grep -v ^$`
#str2=`echo -e "\n" |... (4 Replies)
Hi
I'm trying to loop through an array that contains other arrays and these arrays consist of strings with spaces. The problem is that I can't seem to preserve the spacing in the string. The string with spaces are either divided into multiple items if I change IFS to \n or all the elements of... (4 Replies)