Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sun 26 Oct 2014, 00:55
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
Question About bash (or sh)
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 1 Posts_count  
Author Message
Lord_Solrac2

Joined: 22 Dec 2010
Posts: 35
Location: Gurabo, Puerto Rico

PostPosted: Thu 03 Feb 2011, 12:58    Post_subject:  Question About bash (or sh)  

Hi Um How Can I Make a Script that uses CLI
for example::
Code:
script --help

or
Code:
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:
read: Connection reset by peer

On the Non-GUI (Terminal Script) It worked fine, so my point. is (iMount) something like this:
Code:
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:
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)
Back to top
View user's profile Send_private_message AIM YIM 
ken geometrics

Joined: 23 Jan 2009
Posts: 76
Location: California

PostPosted: Thu 03 Feb 2011, 23:44    Post_subject: Re: Question About bash (or sh)  

Lord_Solrac2 wrote:
Hi Um How Can I Make a Script that uses CLI
for example::
Code:
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:

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.
Back to top
View user's profile Send_private_message 
Lord_Solrac2

Joined: 22 Dec 2010
Posts: 35
Location: Gurabo, Puerto Rico

PostPosted: Mon 07 Feb 2011, 09:14    Post_subject: Re: Question About bash (or sh)  

ken geometrics wrote:
Lord_Solrac2 wrote:
Hi Um How Can I Make a Script that uses CLI
for example::
Code:
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:

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:
urxvt -hold -e sshfs root@$ipaddress:$mountdir /mnt/$name-idevice

And This is The Result
Code:
read: Connection reset by peer


The Usage Would Be Very alike but the thing I want to fix is the error with sshfs...
Back to top
View user's profile Send_private_message AIM YIM 
technosaurus


Joined: 18 May 2008
Posts: 4353

PostPosted: Tue 08 Feb 2011, 18:49    Post_subject:  

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

_________________
Web Programming - Pet Packaging 100 & 101
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 1 Posts_count  
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » Off-Topic Area » Programming
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0578s ][ Queries: 12 (0.0037s) ][ GZIP on ]