Question About bash (or sh)

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
Lord_Solrac2
Posts: 35
Joined: Thu 23 Dec 2010, 00:58
Location: Gurabo, Puerto Rico
Contact:

Question About bash (or sh)

#1 Post by Lord_Solrac2 »

Hi Um How Can I Make a Script that uses CLI
for example::

Code: Select all

script --help
or

Code: Select all

script -mount /dir/to/mount
or so?
The Application I'm Using is SSH...
And I Made a GTKDialog3 Script and the GUI worked fine... But when I noticed, sshfs error was:

Code: Select all

read: Connection reset by peer
On the Non-GUI (Terminal Script) It worked fine, so my point. is (iMount) something like this:

Code: Select all

imount  -device=iPod -user=root -ip=0.0.0.0 -mount=true -name=name -dir=/mnt/$name-$device -target=/var/mobile
to launch (or execute) this:

Code: Select all

sshfs root@$ip:$target $mnt
Or Should I Just Stick in with the Original Version?
The GTKDialog3 Topic is Here

Note: You may NOT Use/Distribuate/Post this Software as your own, Thank You. (Unless With Permission)

ken geometrics
Posts: 76
Joined: Fri 23 Jan 2009, 14:59
Location: California

Re: Question About bash (or sh)

#2 Post by ken geometrics »

Lord_Solrac2 wrote:Hi Um How Can I Make a Script that uses CLI
for example::

Code: Select all

script --help
(big snip here)
I'm not sure I fully understand your question. There are several good explanations of doing bash scripts on the internet. Google will help you find them

What I often do is go through the passed parameters one by one and set local variables to the values they indicate.

it looks a little like this:

Code: Select all

while [[ "$1" != "" ]] ; do
  case $1 in
    -A) ACH="$2"
       shift
       ;;
    -B) BOGUS=YES
      ;;
    case
    shift
    done
The -A parameter takes whatever is next in the command line.
The -B parameter needs no following value

Once the parameters are all shifted way, the code can then work with the settings.

Lord_Solrac2
Posts: 35
Joined: Thu 23 Dec 2010, 00:58
Location: Gurabo, Puerto Rico
Contact:

Re: Question About bash (or sh)

#3 Post by Lord_Solrac2 »

ken geometrics wrote:
Lord_Solrac2 wrote:Hi Um How Can I Make a Script that uses CLI
for example::

Code: Select all

script --help
(big snip here)
I'm not sure I fully understand your question. There are several good explanations of doing bash scripts on the internet. Google will help you find them

What I often do is go through the passed parameters one by one and set local variables to the values they indicate.

it looks a little like this:

Code: Select all

while [[ "$1" != "" ]] ; do
  case $1 in
    -A) ACH="$2"
       shift
       ;;
    -B) BOGUS=YES
      ;;
    case
    shift
    done
The -A parameter takes whatever is next in the command line.
The -B parameter needs no following value

Once the parameters are all shifted way, the code can then work with the settings.
Well I want to make a Script Of This Kind Due To This: (sshfs error with gtkdialog3)

Code: Select all

urxvt -hold -e sshfs root@$ipaddress:$mountdir /mnt/$name-idevice
And This is The Result

Code: Select all

read: Connection reset by peer 
The Usage Would Be Very alike but the thing I want to fix is the error with sshfs...

User avatar
technosaurus
Posts: 4853
Joined: Mon 19 May 2008, 01:24
Location: Blue Springs, MO
Contact:

#4 Post by technosaurus »

Here is another example (replaces rox with other defaultfilemanager)
http://www.murga-linux.com/puppy/viewtopic.php?p=488976

to force a hold, you can add a "read" (no quotes) to the end of your script and it will wait for you to press enter
Check out my [url=https://github.com/technosaurus]github repositories[/url]. I may eventually get around to updating my [url=http://bashismal.blogspot.com]blogspot[/url].

Post Reply