LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
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 11-26-2010, 02:30 AM   #1
zev42
LQ Newbie
 
Registered: Sep 2010
Distribution: Unbuntu 10.04
Posts: 18

Rep: Reputation: 0
script to open pseudo-terminal at user login to GUI: ubuntu (kiwi) 10.04


hello all,
I've been able to write a basic script that opens a terminal and echo's a lil message
my issue, i want it to open its pseudoterminal as soon as i log into GUI
the script:

Code:
#!/bin/bash
if [ $1 = "start" ]
then
	echo `gnome-terminal -x bash -c "echo 'standard daemon modified' ; bash"` 
	sleep 4
elif [ $1 = "stop" ]
then	
	echo "standard daemon executed"
	sleep 4
elif [ $1 = "restart" ] 
then 
	echo "standard daemon resurrected"
	sleep 4
fi
ive tried putting it in /usr/bin as an .sh file
while simultaneously adding it to the /user/share/gnome/autostart dir

also, editing the .bashrc and or .bash_profile (s) in /home/*user*
and other locations only once yeilded my chosen echo, and that only after i had opened the pseudo terminal manually.

any and all help is most appreciated, im not looking for a handout, but nudges are good!
(note, the script is chmod'd to 755, and hence, executable by root or reg users. thx)
 
Old 12-07-2010, 11:39 AM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Location: Wales, UK
Distribution: Arch
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 345Reputation: 345Reputation: 345Reputation: 345
I think it should be:
Code:
#!/bin/bash
if [[ "$1" -eq "start" ]]
then
	echo `gnome-terminal -x bash -c "echo 'standard daemon modified' ; bash"` 
	sleep 4
elif [[ "$1" -eq "stop" ]]
then	
	echo "standard daemon executed"
	sleep 4
elif [[ "$1" -eq "restart" ]]
then 
	echo "standard daemon resurrected"
	sleep 4
fi
But if not, try putting debug code in. At the start:
Code:
echo $1 >> ~/initScriptDebug
and then, for example in the first "if" clause:
Code:
echo "Entered 'start' clause"
That way you know what it thinks $1, and also whether it's an error in your syntax so that it's not executing the commands you think it is (as I believe the problem is) or whether the commands themselves don't work

Hope this helps

EDIT: Tell a lie, '=' is the same as '-eq'. Looking at the code on http://tldp.org/LDP/abs/html/comparison-ops.html, perhaps try putting the $1 in quotes? (example above amended)

Last edited by Snark1994; 12-07-2010 at 11:45 AM. Reason: Answering before thinking+researching ;)
 
  


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
i m running ubuntu 8.10 .unable to login as a user in gui mode. chandan766 Linux - Newbie 1 04-05-2009 06:03 PM
LXer: Addendum Ubuntu 8.04 - Pseudo Root User - II LXer Syndicated Linux News 0 11-18-2008 11:50 AM
LXer: Addendum Ubuntu 8.04 - Pseudo Root User LXer Syndicated Linux News 0 10-20-2008 06:50 PM
LXer: Thoughts About Ubuntu 8.04 - Pseudo Root User LXer Syndicated Linux News 0 10-07-2008 08:10 AM
auto execution of script on ubuntu when user login Mr.J Ubuntu 2 07-04-2008 06:04 AM


All times are GMT -5. The time now is 10:15 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration