[GRASSLIST:9979] Re: bash scripting

David Finlayson david.p.finlayson at gmail.com
Tue Jan 24 17:45:10 EST 2006


An alternative to nohup that I use in similar situations is "screen".
>From a terminal launch screen:

$ screen

(Read the help message and hit the space bar)

You will now be returned to the bash prompt.

Launch grass6 -text

run your shell script in the normal way from grass.

As messages start to scroll away for the hundreds of r.los commands
you are running. Hit CTRL + a, d (detach)

This will detach screen from the terminal and you will be returned to
the original bash prompt from which you started.

Log off, go home. Dial in to your computer at night and type:

$ screen -r (reconnect)

You will be back in grass and can see how far it got while you were away.

There are lots of options to screen. It's a great program for these situations.

David

On 1/24/06, James Conolly <jamesconolly at trentu.ca> wrote:
> Hello all,
>
> I need to run several hundred instances of r.los, and I'd like to do this in a bash script that calls and runs GRASS (so that I can prefix the script with a nohup command and logout and leave it running). If somebody with more knowledge of bash scripting could please provide me with some advice on how to best do this, I'd appreciate it very much. As is stands, if the following script:
>
> #!/bin/sh
> GRASS60 -text /grassdata/mylocation/PERMANENT
> r.los input=dem.v1 output=los.1 coordinate=1234,1234 max_dist=10000
> r.los input=dem.v1 output=los.1 coordinate=6789,6789 max_dist=10000
> end 0
>
> is run, GRASS60 opens, then sits there waiting for a command. Only if I then exit GRASS normally (i.e., exit), will it then move onto executing the r.los commands, but obviously as I'm no longer in the GRASS shell, I get a command not found. I understand all this, but my knowledge of bash scripting is too limited to work out how to get the script to move onto r.los to execute while in the GRASS shell...
>
> Any/all help appreciated,
>
> With thanks,
>
> James Conolly
> Trent University, Canada
>
>


--
David Finlayson
Marine Geology & Geophysics
School of Oceanography
Box 357940
University of Washington
Seattle, WA  98195-7940
USA

Office: Marine Sciences Building, Room 112
Phone: (206) 616-9407
Web: http://students.washington.edu/dfinlays




More information about the grass-user mailing list