Red Hat / Fedora :: Passing Xml In Mem Or Variable To Xmllint?
Jul 24, 2010
How can I pass xml data from memory or a variable to xmllint that expects a file as input? Or does xmllint have the capabilities to read from stin or a variable?
I have installed FC13 on my laptop and set it up as a development server. Here is my issue when passing variable from one page to the next it gets lost. My PHP includes work DB connect string works from the include.
I am new to bash scripting. I want to know whether i can pass one variable to another. For example $1 represent argument1. Now if i want to get the argument 1 like USER="1" now i want $ of $USER to execute $1 so what should i do..
I have a file with around 1000 IP addresses in it and I need to be able to ssh into each one of them, run a single command, and then exit. I already know the ssh command I want to run and it looks like this:
(I know shpass is not good to use and keys are the correct way but I don't have any other options in this scenario.) if these ip addresses were in a .csv file, by themselves with no other information, how would I create a script to do the above command to each ip until the end of the file?
An input filename ($1) is fed into mediainfo, which by the use of grep and cut spits out a single number which is the aspect ratio. This is then divided by bc into 320, which gives the desired height dimension for the file that I want ffmpeg to create for me. Finally, ffmpeg runs using the calculated dimensions... Basically, it's the passing of the $ASPECT variable to bc that seems to fail. It looks like bc won't read the output from the mediainfo line... It always crashes out with:
Code:
(standard_in) 1: illegal character: ^M I've tried doing something even simpler like this to debug by just trying it to display the calculation on the screen:
I want to build on the code from /etc/apt/apt.conf.d/05etckeeper to work with Snapper, the new-in btrfs (et al) snapshot package.
Code: Select allDPkg::Pre-Invoke    { "if [ -x /usr/bin/etckeeper ]; then etckeeper pre-install; fi"; }; DPkg::Post-Invoke   { "if [ -x /usr/bin/etckeeper ]; then etckeeper post-install; fi"; };
The etckeeper code will work well as a template, but I need to pass a parameter between the pre- and post- instances. The parameter is obtained from the pre- invocation and passed to the post- invocation.I know that something similar to my quest is done with the 'pid' but how to do it in the 'standard' way. Happily there can't be multiple dpkg instances running concurrently (prevented by dpkg?) so I don't have to worry about that issue.
Q1. What is the 'standard' way of passing parameters about?
Code: Select allsnapper -c etc create -t pre -p   (which 'prints' the parameter (int) to pass to the following invocation) snapper -c etc create -t post --pre-number <parameter> in place of the two etckeeper calls.
Q2. How do I pick up the 'printed' output of the 'pre' call? I think it's just a 'get' from the stream but perhaps I've missed something.?
I want to know is there some more efficient way of passing a pointer to a local variable as a parameter to a function in x86 asm? Right now I have to move the base pointer to a temp register, subtract from the register and pass that, like this (assuming a local var at esp-4):
Code: mov eax, ebp sub eax, 4 push eax Is there a better way?
I'm having some trouble this morning to send a SQL query to our Oracle DB server in PHP. When I try to pass my value "OF/110246801A01" as variable it tell's me "Warning: oci_bind_by_name(): ORA-01036: illegal variable name/number"
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'm trying to implement an assert function similar to:[url]
However, I'm having trouble with file existence testing when the file name has a space in it.
I have distilled the problem down to the following:
This code works as expected, printing 'yes' if '~/test file' exists, and no if not.
Code:
However, this code gives an error.
Code:
The error:
Code:
Which tells me that it is splitting ["~/test file"] into ["~/test] and [file"]. Why? Is there a way around this?
Note that if you simply use a file path without a space, both cases work perfectly. Is this a BASH bug possibly? I just can't understand why the first would work, but the second wouldn't.
"While ; do ; done" is very convenient for SH coding. However sometimes you may be annoyed by your computed variable within the "while do done" type loop. What to do how to pass it out of the loop to the outside of the bash code? A solution is to write it into the /tmp or on the disk... and to call it back after. - not elegant... really not... Anyone would know a trick another alternative that would look nicer?
Code: # Count file total size TOTAL_SIZE=0 LISTOFFILES=`cat "$HOME/.fvwmoscfg/fvwmburnerlist.lst"` echo "$LISTOFFILES" | while read i ; do SIZE=`du -bs $i | cut -f 1` TOTAL_SIZE=`expr $SIZE + $TOTAL_SIZE` echo "$TOTAL_SIZE" > "$HOME/.fvwmoscfg/fvwmburnerlisttotalsize.lst" done TOTAL_SIZE=`cat $HOME/.fvwmoscfg/fvwmburnerlisttotalsize.lst`
echo "The total size of all files and folders is : $TOTAL_SIZE"
i have trouble with my graphical interface, i cant get the window where i can type login and password, its only black, so how can i get into files, an other way to get into the sessio?
about 6 months ago i reformatted my computer, and after it was all said and done i lost my audio in the process, well i tried countless times to fix it and every time i go to install realtek AC 97 it pops up during installation saying "the software you are installing has not passed the windows logo testing to verify its compatibility with the windows XP" i have read many forums and i see this is a frequent problem to some folks.
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).
my script has a variable which comes in the form +00.00 +0.00 -00.00 or -0.00 (the numbers can be any in that form) for any that have a + symbol I need to remove the +, but if it has a - symbol it needs to stay.
i need to make a new variable with the string from the old variable btut without any plus sign. I have tried a lot of different ways with no success, each thing I tried either left the + or removed the entire string. I think this should work but doesn't
I am supposed to create an environment variable with the PRINTER variable, which should resolve to the word sales. Would the command be like this?: env PRINTER - NAME=SALES (is this the command to create that variable with resolving the word sales to it?)
can i use the value of one variable to generate a name for another variable? for example i want to use the counter from a "do while" loop to name and define a variable each time the loop executes. for example
objectnames1=`ls -a` objectnames2=`ls -a` etc.
i don't have a script yet but each time through the loop i intend to cd to a particular directory and then define a variable containing a list of each object in that directory as values. for the rest of the script to work, each variable generated has to be unique, and i can't think of a good way to accomplish this.
if using a value from one variable to name another isn't possible, can anyone think of a more elegant solution? i know limited syntax but i'm willing to read up...
I am trying to alter the character position of residue numbers above 999 in a pdb file.The following script is an attempt to:1) Get all unique pdb residue numbers (in column 5) using awk and assign it to a variable i.2) Loop through all the values in $i and if it is greater than 999, shift that number one character to the right using sed.However, the script only manages to alter the final residue numberCould anyone please advise how I can loop through all values in $i and shift it one character to the right?
#!/bin/bash # Script to alter position of residue number in pdb file for resid above 999 i=$(awk '{print $5}' wt-test.pdb | uniq)
I was doing a preupgrade from f12 to f13. That was interrupted by a power cut. When I tried to redo it by booting from the grub option, it failed (can't remember the error). I then re-ran preupgrade, but got the "the root for the previously installed system was not found" error even though the UUID was correct and even when I referenced the partion by device - /dev/sda14.
So I decided to go old school: 1. yum update 2. change the repos manually to reference f13 3. yum update
So as it stands these are seemingly the only remaining f12 packages
Code:
But i am guessing due to the interrupted preupgrade, the releasever variable has not been updated. How can I manually do that?
Assumed I have have a variable $userlist, it has the following contents:
brownj smithk smithk2 smithk3 hynesp hynesp2 leeb
How can I write a bash script that extracts all the strings smithk, smithk2, smithk3, etc from variable $userlist, and assigns these strings to a new variable?
I can print a specific line of a file with:$ sed -n '20p' myFileHow can I store it in a variable (in a shell script)?(I wasn't successful with "myVar=sed -n '20p' myFile" for example)