My script works from ROX, not from command line.Why?(SOLVED)

Using applications, configuring, problems
Post Reply
Message
Author
puppypilgrim
Posts: 85
Joined: Tue 07 Jun 2005, 06:32
Location: Horsefly, Canada
Contact:

My script works from ROX, not from command line.Why?(SOLVED)

#1 Post by puppypilgrim »

Can someone help me understand why the following script works when it is set as an icon and clicked on in Rox, but cannot be run from an RXVT window?

(capitalized words are user variables)

-------------------------- start rdp.sh script ---------------------------
#!/bin/sh
rdesktop -u NAME -p PASSWORD -f SERVER
------------------------- end rdp.sh script -----------------------------

I would expect typing "rdp" in an RXVT window to launch the rdesktop program with the defined variables but instead I get this message:

bash: rdp: command not found

I have already applied the chmod a+x to the file rdp.sh and it shows up properly as permissions set to be executable. Permissions:

-rwxr-xr-x 1 64 Jan 13 10:50 rdp.sh

Thanks.
Last edited by puppypilgrim on Fri 13 Jan 2006, 20:53, edited 1 time in total.

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#2 Post by MU »

different to windows, you cannot type "myscript" instead of "myscript.bat".

So you must type "rdp.sh" or rename it to "rdp".

It also must be saved in one of the folders, that is in the $PATH.

On Puppy, use the folders
/usr/local/bin
or
/root/my-applications/bin


Another possibility:
Use "alias", for example
alias rdp=/root/teststuff/rdp.sh


Mark

User avatar
rarsa
Posts: 3053
Joined: Sun 29 May 2005, 20:30
Location: Kitchener, Ontario, Canada
Contact:

#3 Post by rarsa »

Another important distinction is that in windows the current directory is the first one searched for the executable.

In Linux, the current directory is usually not in the search path. If you want to execute a script from the current directory you need to be explicit about that:

Code: Select all

# ./rdp.sh

puppypilgrim
Posts: 85
Joined: Tue 07 Jun 2005, 06:32
Location: Horsefly, Canada
Contact:

#4 Post by puppypilgrim »

Wow. I would never have guessed the answer to that guys even though I have had Linux reference books from Slackware 5 and RedHat 5.

Perhaps if might be a good idea to have some fundamental differences between Windows\DOS and Linux compared side to side on a wiki or web page.

I am still transitioning from Windows to Linux and just love my Puppy! But find I am often alienated and frustrated trying to get up and running with Linux. Where I was once very proficient in Windows and the DOS prompt, I suddenly find myself in Linux kindergarten again! :)

Part of the journey, part of the journey.... Thanks for the help.

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#5 Post by Flash »

Well, Pilgrim, why don't you mosey over to the Wiki and add a page on the subject (or edit an existing page, whichever seems best) while it is fresh in your mind? :)

User avatar
MU
Posts: 13649
Joined: Wed 24 Aug 2005, 16:52
Location: Karlsruhe, Germany
Contact:

#6 Post by MU »

It is just a question of habit.
I started on Apple2/C64, then did some intensive years of Dos/Win.
Linux was "strange" in the beginning then, but now that I am used to it, I have problems with the Windows (cmd) -commands.

I even installed http://unxutils.sf.net , to feel not so desperate in win...

kethd
Posts: 451
Joined: Thu 20 Oct 2005, 12:54
Location: Boston MA USA

#7 Post by kethd »

puppypilgrim,

Another way of dealing with your original question is to invoke the shell explicitly:
# bash rdp.sh

It sounds like you are going through the same agony I was going through a month or two ago, transitioning from the comfort of DOS/Windows to the alien Linux command line. The Puppy Forum and Wiki have some good resources to help you -- and please add the best ones you find!

The most important advice I have for you:

Find the best command-line tutorials and make yourself work through them, so that you learn most tricks without having to bash your head against a brick wall for hours first.

Find the best Linux-command wiki-type resource and keep refering to it for each thing you encounter.
http://wiki.linuxquestions.org/wiki/All_Commands

Here is one to consider:
http://www.unixguide.net/linux/linuxshortcuts.shtml

And try my wiki pages about ash/bash...

Post Reply