Ubuntu :: BASH Script Keeps Looping Infinitely?

May 27, 2011

I have a simple .bashrc backup script I've been working on, but my external hard drive needs to be plugged in for it to work. So I set up a while loop, that exits after the hard drive has been plugged in and backed up. Here it is:

Code:
#/bin/bash
pluggedin=1

[code]....

View 4 Replies


ADVERTISEMENT

Ubuntu :: Bash Script Not Looping As Intended?

Nov 2, 2010

I've written a bash script to connect to each machine in our local network and update the fstab file to point certain NFS mounts to a new location.The script is meant to read in a list of shares and a list of workstations, rsync the relevant share then connect to each workstation and update the fstab file before moving onto the next share.In reality what is happening is it will perform the loop correctly for the first workstation in the list but will not move on to the next one. I'm really stumped on this and I'm sure it's something simple but I just can't seem to work out the answer!

Code:
#!/bin/bash
SHARES=$1

[code]....

View 6 Replies View Related

Programming :: Looping Over Mysql Query Results In Bash?

Sep 15, 2010

I am querying a single string column in a table. The string values have spaces in them. I want to loop over each value in bash. I set IFS to split lists on newlines instead of spaces. When I try this, it is splitting the list of results on the actual character 'n', not the newline ''.

DATA=`mysql -u root -ppassword --silent 'SELECT name FROM table_a;'`
IFS=$'
'
for i in $DATA; do
echo "item = $i"

[Code]....

View 5 Replies View Related

Ubuntu :: Firefox Infinitely Replicating Bookmarks?

Aug 3, 2010

So I was playing RollerCoaster Tycoon 2 in a WINE Virtual Desktop when I went to check my email. I launched Firefox and suddenly my bookmarks started to replicate and haven't stopped. I've recorded this happening. Link here: [URL]

View 9 Replies View Related

Programming :: SSH Timeout - Stays Infinitely In The Background

Nov 24, 2008

I have a program that calls a program on a remote host via SSH in the background. In the command similar to the following:

But the problem is, this program stays infinitely in the background. Is there any method of implementation so that I can kill it? like after 10 seconds of trying?

I am trying to refrain from using TCPKeepAlive or sshd_config stuffs configurations. I was thinking of a fork() implementation where the parent sleeps for 10 seconds and then, if the child still haven responds to it, kill it.

View 4 Replies View Related

Ubuntu :: Computer Boot Looping Before Grub.

Mar 10, 2010

I have 9.10 installed, grub has loaded and worked, now all of a sudden nothing will boot.The HP screen comes up and then the computer reboot, constant reboot cycle. Can't even get into the BIOS. It will just sit there if I hit escape. Won't boot the live cd either. What can I do??? It has worked fine for the past month now.

View 6 Replies View Related

Ubuntu Installation :: Hangs Infinitely At "Preparing To Install Netbook"?

Oct 16, 2010

I'm using a EeePC 1000H and wanted to upgrade 8.10 to 10.10.[URL].. I chose to do a new install.

The following partitions are present:

- WindowsXP, 2 NTFS partitions
- ext3 where 8.10 sits. It is of EasyPeasy-flavour (no other version available at that time)
- hidden partition where WinPE resides

I downloaded the ISO and put it on a USB stick (4GB). Booting works fine. Using it as a live-system works fine as well. Problem came when I want to install it. The process hangs at "Preparing to install Ubuntu-Netbook" after clicking "forward". Nothing happens afterwards. In the menubar a crash-report detected-notification appears, saying: Quote:

The problem cannot be reported: The program crashed on an assertion failure, but the message could not be retrieved. Apport does not support reporting these crashes Unfortunately no other information available.[URL].. but not the same hardware. The thread there seens bot to be of much use anyway, therefore this new post.

View 9 Replies View Related

Software :: Scp Is Looping Without Being In A Loop?

Jun 18, 2010

I'm trying to execute some fairly simple code to transfer some files from one server to another.

$ cat xfer_directory.sh
#!/bin/bash
cd /cygdrive/g/directory/usr

[code]....

View 1 Replies View Related

General :: Change The Value Of The Inputs In Sed While Looping?

Feb 21, 2011

how to change the value of the inputs in sed while looping

As such:

for i in `seq 1 10`; do
"do something funny, using OpenFOAM"
cd system
sed 's/oldvalue/oldValue+increment/' -i sampleDict
cd ..
done

So basically, can you for instance create a constant "a" and increase it for every loop interval and use it for sed?

View 2 Replies View Related

General :: Looping Through Csv File To Calculate Avg/min/max?

Sep 1, 2010

I have a csv file (id, loc, timestamp, impressions) that I need to derive some low-level calculations from. Im ok with basic sort and grep operations, but this one is challenging my feeble scripting skills (normally I�d throw it into a spreadsheet, but in this case Id like to ultimately create a script that I could automate). Ive already used cat/sort to order the csv file first on location and then timestamp so it looks like this:

Abt001, AA, 2009-01-01 10:51:00, 231
Cup002, AA, 2009-01-01 10:54:00, 3
Saf001, AB, 2009-01-01 10:51:00, 25

[code]....

What Id like to do is output to file a record of the total, min, and max number of impressions for each location. , e.g.

AA6504 3231
AB252525
AC37925109
ZZ35512341

how to do this and Im kind of stuck on how to approach it I think the combined steps of looping through the locations along with the min/max/sum calculations are throwing me. Eventually Id also like to do additional calculations like average, ect. but I think I can figure that out on my own if I can just get this part down.

View 10 Replies View Related

OpenSUSE Install :: Update Keeps Looping Back?

Apr 5, 2010

I've had openSUSE for a week. The update says that there are 10 updates. When I run it, first I get a flag saying that something can't be removed. Then when I run the rest of the up date, it loops back and starts over. I need a patch to fix the patch that fixes the patch that...etc.

View 8 Replies View Related

General :: Looping Through A Shell Script With Sql Statements?

Oct 7, 2009

I'm working on the Solaris environment and the DB i'm using is Oracle 10g. Skeleton of what I'm attempting; Write a ksh script to perform the following. I have no idea how to include my sql query within a shell script and loop through the statements. Have therefore given a jist of what I'm attempting, below.

1. Copy file to be processed (one file at a time, from a list of 10 files in the folder ).

Code:

for i in *
do
cp $i /home/temp

2 . Create a snapshot(n) table : Initialize n = 1

Code:

create table test insert account_no, balance from records_all; -- creates my snapshot table and inserts records in SQL

3. Checking if the table has been created successfully:

Code:

select count(*) from snapshot1 -- query out the number of records in the table -- always fixed, say at 400000

Code:

if( select count(*) from snapshot(n) = 400000 )
echo " table creation successful.. proceed to the next step "
else
echo " problem creating table, exiting the script .. "

4. If table creation is successful,

Code:

echo " select max(value) from results_all " -- printing the max value to console

[code]....

View 7 Replies View Related

Ubuntu Installation :: Make Dell Spash Screen Stop Looping?

Oct 18, 2010

Why, after a successful (I thought) dual boot installation w/ a side-by-side lynx and meerkat install and XP does my system refuse to boot? It just gets to the Dell screen, giving boot options (none of which are making any difference) and keeps looping it. Last night, after re-installing the grub (lost after the XP install) everything was working fine. I powered down and this morning tried to restart and...this. I really don't want to have to reinstall everything and reconfigure and reinstall apps--what can I do? And more importantly, WTF did this happen to begin with?

View 1 Replies View Related

Programming :: Looping Using While Read Line And A Variable Instead Of A File?

Sep 24, 2010

I created the following.

x="top
middle
bottom"

I would like to make the following work.

while read line
do
echo $line
done

instead of importing a file I would like to use the variable $x I tried using pipes, but with no luck. My goal is to read one line at a time, but not have to export my data to another file, I would like to keep it all within one script.

View 3 Replies View Related

Programming :: Looping Throghu Input Files With Different Number Of Days?

Nov 3, 2010

I want to itemize addition for each type of transactions. The example below is for 3 days,10/13/2010, 10/14/2010, & 10/15/2010.

PROD =89.25+89.25+104.47= 282.97
TAX =9.37+9.37+10.37 = 29.71
ETAX = 1+1+1 = 3

[code]...

View 8 Replies View Related

Programming :: VBA / Excel - Looping Through Image Controls Based On Cell Contents?

Jun 28, 2011

I have an Excel Spreadsheet which reports upon weekly performance. One portion of the worksheet looks at week over week increases /decreases. I've placed a number of image controls (15 in Total) next to cells which calculate week over week change. The image controls simply display an image depending on whether the value of the adjacent cell is positive or negative. So, here is my basic working IF statement:

Code:

Private Sub Worksheet_Change(ByVal UpDown As Range)
If Range("J26") > 0 And IsNumeric(Range("J26").Value) Then
Image1.Picture = LoadPicture("C:path oup_arrow.gif")
ElseIf Range("J26") < 0 And IsNumeric(Range("J26").Value) Then

[code]....

As you can see, this is pretty simple. What I'd like to do is find a way to loop through all 15 controls and avoid having 15 IF statements run on the Worksheet_Change() event. The cells containing the week over week values are all in the same column, but not continuous. Involved cells are: ("J26", "J27", "J33", "J34", "J35", "J36", "J37", "J38", "J39", "J40", "J42", "J43", "J44", "J45", "J46")

View 6 Replies View Related

Ubuntu :: Terminal Bash / -bash: Ls: Command Not Found

Jun 5, 2011

I got a problem with terminal, since i'm really a noob with terminal i don't know how to fix it.Everytime i type in a command it shows for example:

-bash: ls: command not found

Even the basic commands don't work... just cd <directory> and those things works

View 9 Replies View Related

Programming :: Bash: Printing The Line Number In Bash Script?

Feb 4, 2011

I would like to know how do I print the line # in a script. My requirement is, I have a script which is about ~5000 lines long. If there are any errors happen I just exit. And I would like to add the line # of the script where the error happened.

View 3 Replies View Related

General :: Write A Literal Bash Command In A Bash File?

Nov 29, 2010

I create a bash script that writes another bash file. But in the generated bash file I want to write a bash command in the file and not executing it.Here's my bash file:

Code:
#!/bin/bash
cat > ~/generateGridmix2data.sh << END

[code]...

View 6 Replies View Related

General :: Running Bash But Common Bash Commands Not Working?

Jul 17, 2010

below are the details of my system. I have bash as my current shell, some really common commands aren't working.

Do I need to do a re-installation of bash? Or how do I install a selection of bash commands which I need? (for example a subset of [URL])

Code:
root@sdptfw:~ # uname -a
Linux sdptfw.sdpt.co.za 2.4.36 #1 Tue Jul 22 13:13:24 GMT 2008 i686 i686 i386 GNU/Linux
root@sdptfw:~ # echo $SHELL$
/bin/bash$

[Code]....

View 13 Replies View Related

Programming :: Bash Ctrl+c Tarp And Bash Read With Timeout?

Jan 24, 2010

simple bash code:

Code:
#!/bin/bash
trap "echo 'you got me'" SIGINT SIGTERM # to trap ctrl+c
echo "Press ctrl+c during 5 sec loop"
for ((i=0;i<5;i++)); do

[Code]...

How come code behaves normally and stops when ctrl+c signal is caught and resumes, but after I use at least one timeout read in the code it looks like, if signal is caught again it doesn't pause the execution but skips the loop. If you remove -t (timeout) option from the read, both loops look the same!

View 10 Replies View Related

Programming :: Reading A Bash Variable In Bash Scripting ?

Nov 26, 2008

I have a config file that contains:

my.config:

Code:

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.

Here is my parse_cmd script:

Code:

View 3 Replies View Related

Programming :: Run Multiple Bash And Php Scripts From A Bash Script?

Jul 25, 2011

I have written quite a few separate bash & scripts and php scripts that up to now I have run from cron jobs. However I have to estimate how long each takes to run, before running the next and so it probably takes much longer than necessary to run them all. They have to run in order.

Now there are so many I am thinking it would be better to have a master bash script that would run one after the other, but I am not sure how to get the master script to wait before starting to run the next script. Is this possible and is there a command that will make the script wait between bash and php scripts , for them to finish, before running the next?

View 5 Replies View Related

Slackware :: Bash - Random Headers When Starting Bash In X?

Jan 13, 2011

I have searched and searched and maybe I don't know how to articulate this issue with out just posting the problem I'm having. Every time I bring up a terminal window I get the following "Header"

declare -x COLORTERM="gnome-terminal"
declare -x CPLUS_INCLUDE_PATH="/usr/lib64/qt/include"
declare -x DBUS_SESSION_BUS_ADDRESS="unix:abstract=/tmp/dbus-xSFd6zqrYQ,guid=dc5e07974559da016842742900000090"
declare -x DISPLAY=":0.0"

[Code]...

To be honest I cheated and used the .bashrc / .profile files from Ubuntu and all was working fine for a while now and it seems something changed to cause this... any ideas on why I am getting this? I checked my .bashrc and my /etc/profile and it doesn't look like anything is amiss..

View 3 Replies View Related

Programming :: Bash: Get Filename And Extension Using Bash?

Jan 9, 2010

I would like to get the filename (without extension) and the extension separately. The best solution I found so far is:

Let FILE="thefilenameofsomefilesfor_instance.txt"

Code:

NAME=`echo "$FILE" | cut -d'.' -f1`
EXTENSION=`echo "$FILE" | cut -d'.' -f2`

I think it would be better to count the len and remove 3 chars to right to get the extension, but it can be macintosh filenames with have 4 chars for extensions.

View 5 Replies View Related

Slackware :: If Close Terminal Ran Bash Script Inside / Bash Script Stops

Apr 28, 2011

I've noticed something, and hoped there was a work around.when I write a simple bash script, and run it, if I close the terminal i ran the bash script inside, the bash script stops. What are the solutions for this? Basically I want to run my bash script and close the terminal, keep the bash script running.

View 6 Replies View Related

General :: SSH Connection From BASH Script Stops Further BASH Script Commands

Dec 3, 2010

What happens when the script executes is that the ssh connection works and parks me at the remote hosts's shell login. Therefore, the "firefox" command refuses to execute. I need to know how to make the "ssh" connection occur, stay open, and go into the background so that the rest of the script can execute.If I could also do this with the "firefox" line so that the entire term window could be closed would also be helpful.

View 3 Replies View Related

Programming :: Write A Bash Script That Sources Another Bash Script?

Jan 29, 2011

I am trying to write a bash script that sources another bash script. Essentially, I need a few lines to check to see if a certain variable is set. If not, I set it manually, and then source a scripts with that variable in the path. I wrote a test script to try it, but for some reason the last line does not work. Here is what I wrote:

#!/bin/sh
source ~setupdir/setup.shrc #just a test, this line works
echo ${#SETUP} # prints 0 if setup is not set, which it isn't
if [ ${#SETUP} -eq 0 ]
then
SETUP="~setupdir"
fi
echo $SETUP # prints ~setupdir

[Code]...

View 5 Replies View Related

General :: Bash - HISTSIZE - Readonly Variable -bash - HISTFILESIZE - Readonly Variable

Dec 8, 2009

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.

View 5 Replies View Related

Ubuntu :: Why Can't Use Bash

Aug 27, 2010

why can't I use bash?

Code:$ bash To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. $ /bin/bash To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details.

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved