Software :: Bash Arrays And Quotes (PvPGN)
Aug 23, 2010
I am trying to get PvPGN working... I have installed all the files, the only thing now is that bntrackd wants to use 'logs/bntrackd.log' for it's logfile, but seeing as it's in /usr/sbin, I want it to use /var/log/bntrackd. This is done with 'bntrackd --logfile=/var/log/bntrackd.log' but when I put that in the script it won't process it as a command (instead splitting it and complaining that I don't have --logfile=/var/log/bntrackd.log installed)
/etc/rc.d/pvpgn:
Code:
#!/bin/bash
...
[ -z "$PVPGN_DAEMONS" ] && PVPGN_DAEMONS=(bnetd d2dbs d2cs)
...
for d in ${PVPGN_DAEMONS[@]}; do
[Code]....
View 4 Replies
ADVERTISEMENT
Apr 24, 2010
When I run for i in $(find -name '*.ogg'); do echo '$i'; done I don't get one line per file as I expected. Instead, when a file name has a space in it, each word comes out in a separate line, so I can't run commands on the files.
View 4 Replies
View Related
Jul 20, 2011
grep -e XkbLayout /etc/X11/xorg.conf | grep -v "^#" | awk '{print $3}'
output = "gb"
sometimes= "us"
View 4 Replies
View Related
Jun 2, 2010
Is there a way to compare an array in a while conditions?
I have one array that contains the results of some search and if the script has found all the items, then it should stop, so my idea is to have a while loop � la:
Code:
View 4 Replies
View Related
Sep 30, 2010
I am writing a script to get the multiples of 2 and 3, place them in an 2 arrays, and then show the common integers. So far everything works fine till the comparision. I don't know how to compare them. Here is the code:
Code:
#!/bin/bash
let num1="2"
let num2="3"
[code]...
View 6 Replies
View Related
Mar 12, 2009
I'm making script for automated compiling of one program which would output builds optimized for many architectures. For clearancy, I do each build in it's own catalogue and list of builds with their respective catalogues would be stored as array. I'm using this guide as reference. It describes making array as naming a variable with additional brackets denoting it's position in array.
In my code, it looks exactly like this:
Code:
mtune[1]="build/mtune/athlon"
mtune[2]="build/mtune/athlon-4"
mtune[3]="build/mtune/athlon-mp"
[code]....
But upon invoking $mtune or any $mtune[x] variable, output is blank, like the variable(s) were never initialized. What am I doing wrong?
View 1 Replies
View Related
May 2, 2010
I wrote the Automatik widget (you can find it at :http://kde-look.org/content/show.php...&PHPSESSID=caeTo improve it, I would like to add this one-line script into a text sensor :
top -b -n 1 | head -12 | tail -6 | sed '/top/d' | awk '{ printf "%-12.12s %-4s %-4s %-3s
" , $12,$9,$10,$2}'
[code]...
View 3 Replies
View Related
May 23, 2011
I would like to combine two arrays and delete duplicates that might occur. I tried to solve it like this:
Code:
combined=( "${results1[@]}" "${results2[@]}" )
printf "${combined[@]}" | sort -n | uniq
Example:
result1 (4 elements):
[Code]....
In my code printf seems to have a problem with elements that have the same letters but a space inbetween. For instance "new foo", "newfoo" are the same for printf
View 5 Replies
View Related
Feb 23, 2010
I've got a situation. I'm having GNU bash version 3.00.16(1) on Solaris 10. I need to declare an array say arr1 which will be populated by an output of a command.
declare -a arr1
arr1=( $(/some/command) )
Supposing it will eventually (after executing the command) have element values as -
arr1[0]=1234
arr1[1]=5678
arr1[2]=7890
Now, I need to declare another set of arrays, one for each of the element values above - e.g.
declare -a arr1_1234
declare -a arr1_5678
declare -a arr1_7890
And I also need to populate elements of each of above 3 arrays with output of another command in a loop. So, these arrays will hold values something like -
arr1_1234[0]="abc"
arr1_1234[1]="def"
arr1_1234[2]="ghi"
arr1_5678[0]="jkl"
arr1_5678[1]="mno"
arr1_5678[2]="pqr"
arr1_7890[0]="tuv"
arr1_7890[1]="xyz"
arr1_7890[2]="aab"
I'm able to declare and populate arr1[*]. My question is how do I declare, populate and print the subsequent arrays and their elements?I am feeling rather thick to get this working.
View 7 Replies
View Related
Aug 2, 2011
I am not sure If anybody has faced this issue, my keyboard is less responsive when pressing the double quote/single quote key, I have to press it twice for it to print the quote( and that too it prints some other data and not exactly a double-quotes). Initially I thought it was issue with my keyboard, but later I see that it is working fine in Windows XP. It looks some kind of setting issue. If you check the below two examples, example a) is the double quote printed in Ubuntu, it doesnt exactly looks like a double-quotes and b) is the one printed in Windows.
View 1 Replies
View Related
Jun 6, 2010
In bash I need to use some equivalent of double quotes inside double quotes (or the other way around.)I need to run the following statement to get the output of foo and store it in a variable while passing foo the $file which probably contains spaces.
Code:
variable=$(foo "$file")
The problem is that foo might return an empty string and if it does I need to catch it
[code]...
View 6 Replies
View Related
Feb 17, 2011
I was going to file a bug to findutils on gnu.org when I saw a notice that asked me whether I knew the difference between these two commands:find -name *.c and find -name "*.c".I use find command quite often but I don't think these two have any difference.
View 2 Replies
View Related
Mar 8, 2010
I exported a spreadsheet file into cvs format.
The cvs file is formatted this way
field1,field2,field3,..etc
I want it to be in a Quote delimited format like so
"field1","field2","field3",..etc
View 2 Replies
View Related
Jul 27, 2011
I have the following command, which works fine:ll /backup/PROD |grep PROD_ |awk -F" " '{print "catalog backuppiece /backup/PROD/"$9";"}'The output is:catalog backuppiece /backup/PROD/PROD_29mi42vn_1_1;BUT... I want single quotes in the result. One before /back.. and one before the ;Like this:catalog backuppiece '/backup/PROD/PROD_29mi42vn_1_1';How do I do that? I tried using ' but it does not work.The following command works, but I get an error message, which prevents me from using the command in a bash file:ll /backup/PROD |grep PROD_ |awk -F" " '{print "catalog backuppiece '''/backup/PROD/"$9"''';"}'awk: warning: escape sequence `'' treated as plain `''
View 3 Replies
View Related
Dec 12, 2009
I converted my programming project over to autotools, which gives me a config.h file with all the cool definitions, like these ones:
Code:
/* Location of data files. */
#define DATADIR "/usr/local/share"
/* Define to the full name of this package. */
#define PACKAGE_NAME "lusus"
And naturally I think this is cool because then I can hardcore these into the binary. To my dismay, however, I discovered that the pre-processor does not do the text-substitution if the macro name is inside another quoted string.
Code:
// Prints out "/usr/local/share/lusus"
std::cout << DATADIR << "/" << PACKAGE_NAME << "
";
[code]....
This seems lame, because then this doesn't work:
Code:
CL_Image leaves_corner_tl(gc, "DATADIR/PACKAGE_NAME/img/leaves_corner_tl.png");
So, am I literally going to have to strcat DATADIR/PACKAGE with the other text every time I want to prefix DATADIR/PACKAGE_NAME onto another string?
View 2 Replies
View Related
Mar 9, 2009
I want to grep for $_POST['whatever']. I've done enough googling and trying different things (and failing) to where I felt it appropriate to post here. How do I identify the single quotes as literals? slashes don't seem to do it.
View 1 Replies
View Related
Jun 24, 2011
In Thunderbird, when composing a reply to an email that you have quoted, is there a way to cut only part of the quoted material? A typical situation is that you have exchanged a series of emails with someone and your reply has all the old emails from your and the otherperson quoted in it. The quotes are nested inside each other. Often I'd like to chop off all the very old messages and just leave the last few. But the Thunderbird editor seems to make it an all-or-nothing proposition. I can cut the whole quote, but can't highlight a few nested parts and cut them.
View 3 Replies
View Related
Jan 29, 2011
I am trying to synchronize the content of the directory my_dir/ from /home to /backup. This directory contains a file which name has a double quote in it, such as to"to. Here is my rsync command:
rsync -Cazh /home/my_dir/ /backup/my_dir/
And I get the following message:
rsync: mkstemp "/backup/my_dir/.to"to.d93PZr" failed: Invalid argument (22)
For info, rsync works well when the synchronized filenames contain single quote, parenthesis and space. Thus, why is it bugging with a double quote?
View 3 Replies
View Related
Jul 28, 2011
trying to edit a huge configuration filer graphviz that containsIP addresses.unfortunately, some of the IP addresses didn't get parsed right and have only 3 octets. I am trying to use sed to find these 3 octet lines and delete the line entirely.example lines in the file look like this.
"22.210.73" -> "192.168.159";
"22.210.232" -> "22.210.248";
i have tried doing various things but to no avail. i had something that looked like this...
sed -i '/"*.*.*"/d' myfile
View 2 Replies
View Related
Nov 4, 2010
I'm trying to write a bash script that has to extract values from a csv file. Problem is there are lines like this:a,b,c,"dd,dd,dd",e,f,gI'm using awk to extract the values but when I try it extract value 4 with awk I get:"ddinstead of:"dd,dd,dd"Does anyone know how to get awk to ignore commas within double quotes?
View 5 Replies
View Related
Feb 24, 2010
We have 'SNOWMAN' UTF-8 character in our files which i need to replace with doublequotes (").The UTF-8 hex value for 'SNOWMAN' is 0xE2 0x98 0x83 (e29883) , I have written the commands like this but it is not working .........sed -i 's/x0xE2 0x98 0x83/"/g' FileName
View 8 Replies
View Related
Dec 12, 2010
I know it is pretty trivial but anyway...I have php file that I am trying to read it looks like this
...
add_item_tabulky("Klaun-PF 2011","klaun_pf2011.jpg","","","");
add_item_tabulky("Pras�tko-�ťastn�
[code]...
View 3 Replies
View Related
Feb 18, 2010
The following script will work when I type the path to the file I want to checksum, but not when I drag the file to the terminal because the linux terminal (unlike the Mac) automatically puts quotes around the file path, which causes an error. (Clarification: am referring to gnome-terminal. Thanks, GrapefruiTgirl.) I did not find anything in gconf-editor or anywhere else to alter this behaviour, and my post in Launchpad is unanswered so far. (the script in itself is not very useful, I just stumbled upon this error when experimenting with bash).
So, is there a workaround for stripping the quotes from the input, or can I configure the terminal to not quote the input when I drag a file into it (which I would prefer?)
I am currently logged in from Mac OS, but the question refers to ubuntu karmic with which I dual boot.
View 6 Replies
View Related
Jan 21, 2010
I have a problem with my keyboard. I�m unable to type single or double quotes, at least not the regular sort that you need to write code in almost any programming language ever invented -which makes it pretty useless.A demonstration.Single left and right tilted quotes:Double quotes: m not able to type a single straight quote at all.I just want my keyboard layout to be standard US like everyone elses so I can get on with my work so does anybody know how to just reset it to a normal layout?
View 4 Replies
View Related
Jun 2, 2010
What's a good program that shows quotes at startup? Quotes that I could edit and add to?
View 6 Replies
View Related
Jun 10, 2010
I'm experimenting with old linux Distributions again, and while trying tostart an x server, I get the following error message:X: unable to open display ''That makes me think that the config file is incomplete, but I would have no idea how to make it. If there is an auto configuration utility that I do not know about for X, it would be great to hear about. Here are some other specifications that might help:*Host: VMWare Workstation on Windows XP Home*Distribution: Debian 2.2 (potato) (Yes, I know it's old.)*Connection: Local. I've heard of people having difficulties like this on remote connections, but I am on the physical computer
View 7 Replies
View Related
Feb 18, 2010
The following script will work when I type the path to the file I want to checksum, but not when I drag the file to the terminal because the linux terminal (unlike the Mac) automatically puts quotes around the file path, which causes an error. I did not find anything in gconf-editor or anywhere else to alter this behaviour, and my post in Launchpad is unanswered so far. (the script in itself is not very useful, I just stumbled upon this error when experimenting with bash).
So, is there a workaround for stripping the quotes from the input, or can I configure the terminal to not quote the input when I drag a file into it (which I would prefer?)I am currently logged in from Mac OS, but the question refers to ubuntu karmic with which I dual boot.ADMINISTRATORS: Thanks for the quick reply to my newbie question about posting new threads. Actually I don't see now what the difficulty was; I guess I was tired from trying to debug the above script (not funny).
View 1 Replies
View Related
Jan 26, 2011
Can anyone offer a code snippet to recursively go through directories and replace any single or double quotes quotes found in a filename with another character (e.g. "_").If any of the filenames contain a single quote or double quote, then replace it with an underscore.
View 7 Replies
View Related
May 16, 2010
So I think I almost have gnucash figured out. One problem though. When I try to import my stock quotes for my portfolios, It won't get any quotes for my OTC BB Stocks. Under the security editor, there is no option for OTC as an exchange. For example: CNEX. How would I set GnuCash up to import this quote?
View 1 Replies
View Related
Mar 18, 2011
After I assign a string to a variable, I know that the print function will remove the single quotes around the value, but is there a way to assign a variable without the quotes around the value? for example:
a = open('/usr/lib', 'r+')
b = f.read()
c = x.replace('.xx','yy')
d = ?
c returns the value with quotes around it print c returns the value without the quotes Is there a way to assign a new variable (d) which will equal c without the quotes? I need a new variable which has the quotes omitted because from there the script will take the value of the last variable (which is a path to a file), and tar up that file. It won't recognize the path to the file if the value has quotes around it.
View 1 Replies
View Related