I want to create a variable that when passed as a parameter to another bash script will keep its string quotes (so it stays as one parameter). What ways can I achieve this cleanly?
run_repeatedly "programX -o "./messy/path/output-$NUM.txt"" The echo inside the loop prints "...-$NUM.txt"; obviously I'm aiming to have bash substitute the iteration number so that I end up with many output files not 1.
On one of my servers I see this when I log in. What does this mean and how can I get it to go away? Everything seems to work fine, but none of my other machines give this error.
Say, i have an imaginary std library function, which I want to call.
Code: void std_lib_func(ObjectType *param);
Now in my c++ program, I have a main() function, and I will like to call a customized function (which will in turn call the std lib function) from the main function, as below:
Code: int main() { ObjectType *aobj; customized_func(aobj); } [Code]...
I tried the below but get an error that the std lib function is expecting a ObjectType* param, not aobj. How should I work this out.
I got the following modprobe scripts modprobe -k -q streams what does the -k parameter mean?. is it exist in older modprobe? I don't see -k parameter in recent modprobe.
I'm trying to read content of file to variable and use this variable in for loop. The problem is, when I have c++ comment style in file - /*. Spaces in line are also interpreted as separated lines.
For example:
Code:
Changing $files to "$files" eliminate these problems but causes that whole content of variable is treated as one string (one execution of loop).
I'm basically setting up two sshfs mounts and I have it set up so I run one command but type my password twice.Is there an easy to way to input a password using bash and pass that variable to another process asking for a password?
In my script, and I would like to concatenate 2 variables names, to give me the true variable.I've 3 variables X1, X2 and X3, and I invoked them inside a for loop.
When I run this command from shell, it runs ok export REVS=`svn info svn+ssh://svn.myone.ca/var/svn/story/trunk/lib |grep 'Last Changed Rev:'| awk -F: '{print $2}'` However when I save it into a file called test.sh (of course, I chmod it with +x), I got error "export: 2: bad variable name"
Here is the file: #!/bin/bash export REVS=`svn info svn+ssh://svn.myone.ca/var/svn/story/trunk/lib |grep 'Last Changed Rev:'| awk -F: '{print $2}'` I am using ubuntu.
I have a file (.tmpfile) and inside it is a string which i only know part of, the rest being a random group of characters... I would like to know how to pull the whole string out of the file and into a variable.
Now in my bash script, I want to get the output /home/user instead of $HOME once read. So far, I have managed to get the $HOME variable but I can't get it to echo the variable. All I get is the output $HOME.
I'm writing a script for asterisk to monitor trunk failure, i do a loop for every trunk it got nad would like to name variable like server1=, server2= naming the server upgoing as the trunk is. here is the scripts:
[Code]....
what i would like to do is name the variable server, username and status with the count variable, like this server$COUNT to have server1 when on trunk one, bu as soon as i add the $COUNT after the server, it seems to try to make it a command, it says that:
Code: ./test.sh: line 45: server1=74.63.41.218: command not found
Ive been using linux for a while but I am just getting into shell scripting, im currently trying to get a simple script for finding and copying files powered by the command:
Code:
This works fine from the command line but when put in a script such as:
Code:
Code:
with the keyboard inputs for $fc1 and $fc2 being *.doc and ~/test respectivly. The only problem i can see is the xargs -ivar "var" part possibly needing $var to be defined?
i'm not actually using Linux but i figured this might be the right place nonetheless..o i've got this little script file to compile and run some Java code:
I'm making a script I want to be able to just call (ie, rclick instead of ./rclick) where do I put it?
~/bin? /bin? /usr/bin?
Also, how do I pass a variable to the script (rclick 10 will rightclick 10 times) (Found, so simple... $1)Lastly, can I force it to run on CPU2? CPU1 is completley locked up if I run this on it... Or can I make it use less cpu cycles?
Just a simple BASH for loop to read the file path from a text file (clean.txt) echo the variable for debug purposes, and scp it to a server I have using port 50 for SSH.
I've already formatted the entries in clean.txt to handle spaces correctly, using sed replacement.
Example from the clean.txt file:
Code: /MP3/NAS000000001/Barenaked Ladies/Barenaked Ladies - Barenaked For The Holidays/20 Auld Lang Syne.mp3 /MP3/NAS000000001/Barenaked Ladies/Barenaked Ladies - Barenaked For The Holidays/14 Deck the Stills.mp3
I want to write a c program with some shell scripts.Now For a simple C program. I am Setting a variable called val2 in bash, now I want to use bash variable val2 in C code. How do I do that?The above doesn't work (coz its spawning a different memory space and when shell script ends the variable dies with it as per my research but how do I keep them in same memory space)Also Is there any Good reference where they teach how to integrate C and Bash Together?
i've just started to learn about functions in Bash scripting. I'm able to set the functions and execute the commands correctly. However, if my_var is set in the first function and then later in the script in the script the 2nd function is called, it doesn't seem to remember my_var and quits (at least i suspect this is the problem).
Here's my code (it requires yad available via webupd8. org). My specific problem seems to lay in line #27 where if we view the changelog and then exit that window, it returns to the "main" function but any subsequent commands cause a crash. Is this because of the get command on line #29? It's presumably now out of scope after calling menu on line #25?