LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 05-10-2011, 02:21 AM   #1
heinrichmartin
LQ Newbie
 
Registered: May 2011
Posts: 2

Rep: Reputation: 0
xfce4-terminal+bash initialization when using -x parameter


Hello,

there are many "command not found" Q&A out there, but I got stuck here.
Note: this works with gnome-terminal, but not with xfce4-terminal.

Inside an xfce4-terminal from the Desktop ("exo-open --launch TerminalEmulator"), this is the environment:

Code:
user@machine:~$ ll bin
lrwxrwxrwx 1 frq frq 33 Mar 25 14:55 bin -> /home/frq/workspace/core/shtools/
user@machine:~$ cd bin
user@machine:~/bin$ ll void
-rwxr-xr-x 1 frq frq 8 May 10 08:06 void
user@machine:~/bin$ cat void
echo 42
user@machine:~/bin$ void
42
user@machine:~/bin$ echo $PATH
/home/frq/bin:/usr/local/bin:/usr/bin:/bin:/usr/games
As I am trying to run a terminal from a different context, play around with these:
Code:
user@machine:~/bin$ xfce4-terminal -x void ==> FAILS, why?
user@machine:~/bin$ xfce4-terminal -H -x ./void ==> WORKS, but is not what I need...
user@machine:~/bin$ xfce4-terminal -H -x echo $PATH ==> WORKS, but PATH is evaluated before invocation, isn't it?
user@machine:~/bin$ xfce4-terminal -x bash -c "(echo $PATH; read -sn1 -p DONE.)" ==> WORKS
And this drives me mad:
Code:
user@machine:~/bin$ xfce4-terminal -x bash -c "(echo $PATH; void; read -sn1 -p DONE.)"
==> yields ==>
/home/frq/bin:/usr/local/bin:/usr/bin:/bin:/usr/games
bash: void: command not found
DONE.
One part of the solution is, PATH was evaluated in the current context:
Code:
user@machine:~/bin$ xfce4-terminal -x bash -c "(echo \$PATH; void; read -sn1 -p DONE.)"
==> yields ==>
/usr/local/bin:/usr/bin:/bin:/usr/games
bash: void: command not found
DONE.
The PATH comes in ~/.bashrc, but neither the options "--noprofile" nor "--rcfile ~/.bashrc" work!

What else can I try? Or how is the Terminal initialized with or without -x?

Thx in advance!
 
Old 05-10-2011, 06:45 AM   #2
heinrichmartin
LQ Newbie
 
Registered: May 2011
Posts: 2

Original Poster
Rep: Reputation: 0
Sorry for the self-reply. The problem was not xfce4-terminal, but bash... no idea why this had worked with gnome-terminal!

Code:
xfce4-terminal -x bash -ic "void; read -sn1 -p DONE."
this does the job:
Quote:
An interactive shell is one started without non-option arguments and without the -c option whose standard input and error are both connected to terminals (as determined by isatty(3)), or one started with the -i option. PS1 is set and $- includes i if bash is interactive, allowing a shell script or a startup file to test this state.
[...]
When an interactive shell that is not a login shell is started, bash reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if these files exist. This may be inhibited by using the --norc option. The --rcfile file option will force bash to read and execute commands from file instead of /etc/bash.bashrc and ~/.bashrc.
The --rcfile option helps only with -i.
Btw this is how I run command-line tools from eclipse...
 
  


Reply



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
fixed fonts on xfce4-terminal faizlo Linux - Software 2 12-06-2013 02:26 PM
xfce4 terminal colors schlynn Linux - Software 4 10-01-2010 10:43 PM
xfce4 terminal conflict hilltownboy Debian 3 04-12-2009 02:21 PM
linux bash - how to use a dynamic parameter in shell parameter expansion expression nickleus Linux - General 2 08-21-2006 04:54 AM
XFCE4 transparent terminal jkh Linux - Software 2 12-21-2005 05:31 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 09:57 AM.

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