LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-22-2004, 12:59 PM   #1
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Rep: Reputation: 45
bash script how to?


ubb3r newbie here in need of some guidance and help.

i have reciently picked up a book that is writen in a way that i can understand it. its very simular to the way the win2k MCSE books are written so things are finnaly starting to click for me in the linux world.

that is not saying that i know linux near as well as i know M$, but given time i shall learn it as well if not better then i know M$.

background for the reason i am asking for this help.

1. i own a small karate school in orlando area.
2. i use quickbooks for my accounting and PoS (point of sale) software.
3. i use TS(terminal service) to remote into my win2k server box to access quickbooks from any of my workstations and from remote loctions away from my school.
4. i have been playing around with RH9 and rdesktop. i love rdesktop way better then native TS from M$. its faster, smoother, and even though not as nice on the graphical end, im only really using it for QB(quickbooks)

of the ppl i have helping me at my school (wife included) i am the only one who knows more about computers then just how to turn them on. i handle a fair amount of IT work in the M$ world as sideline contracts just to keep my mind sharp.

i have no issue with typing in the long string from the councle to get rdesktop to open, connect, loging, and run for me, but i know for a fact that the ladies that help here at the school would not be happy with me if i tried to make them perform this task.

so i need to learn how to make some kind of script or something that will alow me to creat a desktop icon for Gnome that will be clickable and contain all of the argurments to log in and run in fullscreen mode.

i am wanting to replace the OS on my POS computer as win2k is to much of a system hog for that older computer and would like to put RH9 on it so they can rdesktop over instead of TS over to my server.

the arguemtns that i use now are as follows:

./rdesktop -u [user name here] -p [password] -f [fullscreen] [URL/IP]: port if needed, dont need any ports they way i have it setup.

id like to be able to make a clicky icon that can go on the desktop that will run the above command with the proper info so the ladies just have to double click and then log into QB to make sales or take tuition.

thank you for the help and time.
 
Old 03-22-2004, 02:17 PM   #2
AMMullan
Member
 
Registered: Sep 2003
Location: United Kingdom
Distribution: Ubuntu, Arch
Posts: 438

Rep: Reputation: 30
Hey - good to hear your having a good experience with Linux - give it time and these skills will come naturally lol

Heres something that you could you - also gives a warning if you run it from Konsole and it doesn't exist...

Code:
#! /bin/bash
                                                                                
RDESKTOP=`which rdesktop > /dev/null 2>&1`
  if [ $? -gt 0 ] ; then
    echo "rdesktop not found"
    exit 1
  fi
                                                                                
. ${RDESKTOP} -u [user name here] -p [password] -f [fullscreen] [URL/IP]
Save that as something on the desktop and it should run fine...
Hope that helps
 
Old 03-22-2004, 02:47 PM   #3
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Original Poster
Rep: Reputation: 45
ok, now how do i do that? do i use VI and make a file ot my /home no clue were to find my desktop in the directory tree

if i save it to my /home i know i can find it, and should be able to figure out a way to get it to the desktop.
 
Old 03-22-2004, 02:58 PM   #4
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Original Poster
Rep: Reputation: 45
ok starting to get the hang of things:

[xxxx@localhost xxxx]$ RDESKTOP='which rdesktop > /dev/null 2>&1'
[xxxx@localhost xxxx]$ if [$? -gt 0 ] ; then echo "rdesktop not found"; exit 1 ; fi
bash: [0: command not found
[xxxx@localhost xxxx]$


what is that? and how do i get past it? do i need to be in su mode or can i stay in just normal user mode to make this script work?
 
Old 03-22-2004, 03:07 PM   #5
AMMullan
Member
 
Registered: Sep 2003
Location: United Kingdom
Distribution: Ubuntu, Arch
Posts: 438

Rep: Reputation: 30
No you should be fine as a normal user...

Did you put that in a file and chmod it to be executable?
I tested it and it should work......

Just create a file on the desktop (taking that you use KDE or Gnome) and then add the text that I posted, change the permissions to be executable and then you should be able to double click it.....

Last edited by AMMullan; 03-22-2004 at 03:08 PM.
 
Old 03-22-2004, 03:25 PM   #6
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Original Poster
Rep: Reputation: 45
you are talking way way way over my head. this is my first attempt at any type of coding/scripting

in the M$ world im a hardware network guy so no need for coding skills there. what is chmod? how do i use it, how do i save it to a specific location.

i am not saying it does not work, i am saying i dont know enough to make it work yet.

[edit to add] yes using gnome as my GUI and just using the counsels to access the cmd line.


Last edited by Lleb_KCir; 03-22-2004 at 03:37 PM.
 
Old 03-22-2004, 04:41 PM   #7
Looking_Lost
Senior Member
 
Registered: Apr 2003
Location: Eire
Distribution: Slackware 12.0, OpenSuse 10.3
Posts: 1,120

Rep: Reputation: 45
Your using gnome so you've probably got gedit, open that
and add the stuff given above, save the file as startrdesktop.sh, or whatever

open a shell
login (su) as root

chown root.root startrdesktop.sh # Not particular necessary this if the only log
chmod a+rx startrdesktop.sh # in as one user, but ya might aswell
mv startrdesktop.sh /usr/bin #

right click on your gnome desktop and select add launcher(or whatever it's called) from
the popup menu

In the launcher menu enter in the command to run bit startrdesktop.sh

You should have a runable icon on the desktop now

If they only every log in as one particular user and you are logged in as that user when you created the file you can just, if the file is in /home/myusername,

chmod +x /home/myusername/startrdesktop.sh
then when doing the launcher bit enter the full path to /home/myusername/startrdesktop.sh

not using gnome now but that's the basics from memory

Basically chmod +x makes the file executable/runnable

Last edited by Looking_Lost; 03-22-2004 at 04:44 PM.
 
Old 03-22-2004, 05:33 PM   #8
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Original Poster
Rep: Reputation: 45
wow awsome. that is the level of detail i need. thank you. ill do that when i get home tonight. currently teaching classes at the school.

this will be so awsome to be able to do this. wife will be happy, and so will help once i can speed thigns up for them, and make it clicky. they can do the clicky real well.
 
Old 03-22-2004, 08:31 PM   #9
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Original Poster
Rep: Reputation: 45
ok must of done something wrong.

-------------------------------------

[ray@localhost ray]$ su -
Password:
[root@localhost root]# cd /home/ray
[root@localhost ray]# ls
DAoC_toa.jpg mplayer-gui-1.0pre3-1.i386.rpm
mplayer-common-1.0pre3-1.i386.rpm startrdesktop.sh
[root@localhost ray]# chmod a+rx startrdesktop.sh
[root@localhost ray]# chmod +x /home/ray/startrdesktop/sh
chmod: failed to get attributes of `/home/ray/startrdesktop/sh': No such file or directory
[root@localhost ray]# cd
[root@localhost root]# cd
[root@localhost root]# chmod +x /home/ray/startrdesktop/sh
chmod: failed to get attributes of `/home/ray/startrdesktop/sh': No such file or directory
[root@localhost root]# chmod +x /home/ray/startrdesktop.sh
[root@localhost root]#


------------------------------------

eventualy got the chmod +x to work, but for some reason when i typed it in i got an error, but when i copy/paste it worked, or at least did not give me an error.

---------------------------------------------

#! /bin/bash

RDESKTOP='which rdesktop > /dev/null 2>&1'
if [ $? -gt 0 ] ; then echo "rdesktop not found"
exit 1
fi

${RDESKTOP} -u xxxxxxxxxxxxxxxx -p xxxxxxxxxx-f xxxxxxxxxxxxxxxxx

-------------------------------------------------

saved that to the above dir in my home dir.

when i double click the startrdesktop.sh in Ray's home icon on my desktop it does prompt me to run, run in terminal, dislpay so i must of got some of it right at least.

please help. i know im getting close and would really love to see this working. im very exciting that im learning this much and all the great help is very much appriciated.
 
Old 03-22-2004, 09:16 PM   #10
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Original Poster
Rep: Reputation: 45
woo hoo figured it out.

the solution:

-----------------------------------

#!/bin/bash
/usr/bin/rdesktop -u xxx -p xxxx -f 192.168.2.101

------------------------------------

once i did that along with the chmod for root.root and the chmod -x i now have a clicky desktop icon that goes straight to were i want it to go. now i can make clickies for the rest of the servers.

Thank you so very much for the guidance and help.
 
Old 05-21-2004, 07:53 PM   #11
badogg
LQ Newbie
 
Registered: Mar 2004
Location: Rohnert Park, CA
Distribution: Mandrake
Posts: 16

Rep: Reputation: 0
Wouldn't it have been easier to just create a new icon on the kde desktop, under file/link to application. Then on the command box enter /usr/bin/rdesktop -f -u [username] -p [password] xxx.xxx.xxx.xxx???

That is what I did and it worked like a charm...
 
Old 05-21-2004, 08:03 PM   #12
Lleb_KCir
Senior Member
 
Registered: Nov 2003
Location: Orlando FL
Distribution: Debian
Posts: 1,765

Original Poster
Rep: Reputation: 45
possably, but i use Gnome, not kde so i dont know how that would of worked.

i also needed to be able to edit the command line for the specific locations i need to TS into.

thank you for the sujestion.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash script Linh Programming 4 04-21-2004 06:19 PM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 01:20 AM
bash script - incrementing a filename in a script tslinux Programming 10 08-06-2003 12:58 AM
bash script brian0918 Programming 7 06-12-2003 07:06 PM
bash script prob: how can i tell the script that a 'dd' has finished? Frustin Linux - General 2 04-02-2003 06:34 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:52 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration