Re: need bash variable syntax help
On Fri, Jun 6, 2014 at 11:52 PM, ToddAndMargo wrote: > Hi All, > > In Bash script language, how do I create a variable name > from a variable? > > I am trying to create a variable called "abcStatus" > > x=abc > $xStatus=xyz > > obviously doesn't work. What am I doing wrong? > > Many thanks, > -T It's not really core to Scientific Linux itself, but: For most bash cases where I've found myself wanting something like this, I've usually wound up using "hashes" instead. The first hash, abc, contains a list of variable names, abcstatus, abctime, abcdate, abcowner, etc. that can then be referrenced to refer to other valures or hashes as needed.
Re: need bash variable syntax help
On 6/7/2014 11:25 AM, Nico Kadel-Garcia wrote: On Fri, Jun 6, 2014 at 11:52 PM, ToddAndMargo wrote: Hi All, In Bash script language, how do I create a variable name from a variable? I am trying to create a variable called "abcStatus" x=abc $xStatus=xyz obviously doesn't work. What am I doing wrong? Many thanks, -T It's not really core to Scientific Linux itself, but: For most bash cases where I've found myself wanting something like this, I've usually wound up using "hashes" instead. The first hash, abc, contains a list of variable names, abcstatus, abctime, abcdate, abcowner, etc. that can then be referrenced to refer to other valures or hashes as needed. I agree with everything said so far, but would like to toss in a chapter from the Advanced Bash-Scripting Guide (ABS). The dangers are of course still present, but might give a bit better explanation about what is going on. I actually do have scripts I use that utilize the \$$var method. http://www.tldp.org/LDP/abs/html/ivr.html
Re: Will PCIUSB3S22 work with SL 6.5?
On 05/12/2014 01:02 PM, ToddAndMargo wrote: Hi All, Anyone know how I can figure out whether or not this card will work with SL 6.5, 64 bit (PCIX USB3 card)? StarTech: PCIUSB3S22 http://www.startech.com/Cards-Adapters/USB-3.0/Cards/2-Port-PCI-SuperSpeed-USB-3-Adapter-Card-with-SATA-Power~PCIUSB3S22 I asked their tech support. They said it will work with kernel 3.5. Huh? We are 2.6 and Fedora Core 20 is 3.14. Many thanks, -T Confirmed. It works! :-) -- ~~ Computers are like air conditioners. They malfunction when you open windows ~~
Bash: how do I use a variable as a log file?
Hi All, Bash: I am trying to use a variable to hold a log and add to it as I go. I can do this with a temp file, but I'd rather do it with a variable. I have gotten this far: A=$(echo -e "abc\n") A="$A"$(echo -e "def\n") A="$A"$(echo -e "ghi\n") echo $A abcdefghi echo -e $A abcdefghi What am I doing wrong? Is it better to just break down and just use a file? Many thanks, -T
Re: Bash: how do I use a variable as a log file?
On Saturday 07 June 2014 17:38:35 you wrote: > Hi All, > > Bash: I am trying to use a variable to hold > a log and add to it as I go. I can do this > with a temp file, but I'd rather do it with > a variable. > > I have gotten this far: > > A=$(echo -e "abc\n") > A="$A"$(echo -e "def\n") > A="$A"$(echo -e "ghi\n") > > echo $A > abcdefghi > > echo -e $A > abcdefghi > > What am I doing wrong? Is it better to just break > down and just use a file? The assignment doesn't need echo, and the series of "echo -e" is swallowing the newlines you expected to have in place. Here's an example: - ceverett@jalapeno ~/Code/bash $ cat var-log.bash #! /bin/bash a="start of log" for newdata in $(seq 1 10) do a="$a\n$newdata" done echo -e "$a" ceverett@jalapeno ~/Code/bash $ ./var-log.bash start of log 1 2 3 4 5 6 7 8 9 10 - But really, you shouldn't store a log in a variable, especially if it might receive a lot of traffic (and especially since you lose everything in the event of a program interruption of any sort, which defeats the purpose). You could accumulate a bit of data in a variable, but you should always flush it to a file. The append redirect operator was designed specifically to make this easy; not using it is going against the grain.
Re: Bash: how do I use a variable as a log file?
On 06/07/2014 06:00 PM, zxq9 wrote: On Saturday 07 June 2014 17:38:35 you wrote: Hi All, Bash: I am trying to use a variable to hold a log and add to it as I go. I can do this with a temp file, but I'd rather do it with a variable. I have gotten this far: A=$(echo -e "abc\n") A="$A"$(echo -e "def\n") A="$A"$(echo -e "ghi\n") echo $A abcdefghi echo -e $A abcdefghi What am I doing wrong? Is it better to just break down and just use a file? The assignment doesn't need echo, and the series of "echo -e" is swallowing the newlines you expected to have in place. Here's an example: - ceverett@jalapeno ~/Code/bash $ cat var-log.bash #! /bin/bash a="start of log" for newdata in $(seq 1 10) do a="$a\n$newdata" done echo -e "$a" ceverett@jalapeno ~/Code/bash $ ./var-log.bash start of log 1 2 3 4 5 6 7 8 9 10 - But really, you shouldn't store a log in a variable, especially if it might receive a lot of traffic (and especially since you lose everything in the event of a program interruption of any sort, which defeats the purpose). You could accumulate a bit of data in a variable, but you should always flush it to a file. The append redirect operator was designed specifically to make this easy; not using it is going against the grain. Hi zxq9, I see what I did wrong. Thank you! It is a small log. Only about 20 line of text in it. -T -- ~~ Computers are like air conditioners. They malfunction when you open windows ~~
do_IRQ?
Hi All, SL 6.5, 64 bit About once every four hours or so, this pops up in my xterms: kernel:do_IRQ: 1.165 No irq handler for vector (irq -1) Doesn't seems to hurt anything. Any idea what it means? Many thanks, -T
Re: do_IRQ?
I had similar error on one of our nodes. My was a bug on the motherboard. The work around for me was to add a kernel-boot option to the grub-loader like so: 1. vim /etc/grub.conf 2. kernel .quiet *pci=nomsi,noaer* On Sat, Jun 7, 2014 at 11:47 PM, ToddAndMargo wrote: > Hi All, > > SL 6.5, 64 bit > > About once every four hours or so, this pops up in > my xterms: > > kernel:do_IRQ: 1.165 No irq handler for vector (irq -1) > > Doesn't seems to hurt anything. Any idea what it > means? > > Many thanks, > -T >
Re: do_IRQ?
On Sat, Jun 7, 2014 at 11:47 PM, ToddAndMargo mailto:toddandma...@zoho.com>> wrote: Hi All, SL 6.5, 64 bit About once every four hours or so, this pops up in my xterms: kernel:do_IRQ: 1.165 No irq handler for vector (irq -1) Doesn't seems to hurt anything. Any idea what it means? Many thanks, -T On 06/07/2014 08:53 PM, Tam Nguyen wrote: I had similar error on one of our nodes. My was a bug on the motherboard. The work around for me was to add a kernel-boot option to the grub-loader like so: 1. vim /etc/grub.conf 2. kernel .quiet *pci=nomsi,noaer* Thank you! -- ~~ Computers are like air conditioners. They malfunction when you open windows ~~
figured out how to read bios from the command line
Hi All, I really don't care to reboot my computer and try to read the bios revision as it flashes by. I found this sweet command line utility to read the bios from the command line and wanted to share it: su root -c "dmidecode | less" -T