LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 12-06-2005, 02:56 AM   #1
fiery_ice
Member
 
Registered: Sep 2005
Location: Ontario
Distribution: Debian, Ubuntu
Posts: 33

Rep: Reputation: 15
redirecting the output of pwd into konqueror as a url. using bash


I have been trying to figure this out for quite some time.

Say my current working directory is /home/ice/work

Heres what i have been trying to combine into one command:

Code:
# pwd
then take output of that and redirect it to a bash variable such as
Code:
$HERE
then this should happen
Code:
# echo $HERE

/home/ice/work
My plan is to be able to redirect the output of
Code:
pwd
into a url for viewing in konqueror as konqueror can use a variable as a url.

I have tested it. The following happens.
Code:
# $here=/home/ice/work
# konqueror $here
Konqueror loads with the directory /home/ice/work
But obviosuly this is not useful because i can easily click on the big "home" button in konqueror, then click work.

My questoin would be useful if my current working directory was /use/share/doc/man/man1/foo
Then i could load konqueror with that directory automatically...

Thanks in advance
 
Old 12-06-2005, 04:27 AM   #2
Ynot Irucrem
Member
 
Registered: Apr 2005
Location: Perth, Western Australia
Distribution: Debian
Posts: 233

Rep: Reputation: 30
you can "pipe" the output of one command into the input of another with the | (pipe) character. you would do this with "pwd | konqueror". There is a fantastic guide to bash here.

Also, when assigning something to a variable, you do "VAR=pwd" (without a dollarsign). You only need the dollar sign when retrieving the variable e.g. "echo $VAR".

EDIT: on a US keyboard, the pipe character is normally above ENTER, and is on the same key as \ (backslash).

Last edited by Ynot Irucrem; 12-06-2005 at 04:29 AM.
 
Old 12-06-2005, 08:13 AM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
You can't use a pipe to assign a variable...try this:

VARIABLE=`pwd`

Those are not single quotes, but "backticks" (American keyboard---way left above the tab key)
 
Old 12-06-2005, 03:01 PM   #4
Ynot Irucrem
Member
 
Registered: Apr 2005
Location: Perth, Western Australia
Distribution: Debian
Posts: 233

Rep: Reputation: 30
I was just saying that you don't even need to assign a variable for this, you can just pipe it straight to konqueror.

Though my VAR=pwd was wrong, it should have been (as you said) VAR=`pwd`
 
Old 12-06-2005, 05:11 PM   #5
fiery_ice
Member
 
Registered: Sep 2005
Location: Ontario
Distribution: Debian, Ubuntu
Posts: 33

Original Poster
Rep: Reputation: 15
Thanks alot Ynot Irucrem and pixellany.

It works now, you two saved me alot of stress

~EDIT~
This was my goal. I added this to my .bashrc
Code:
alias 'kk'='here=`pwd`; konqueror $here'

Last edited by fiery_ice; 12-06-2005 at 05:18 PM.
 
Old 04-05-2006, 03:13 PM   #6
fiery_ice
Member
 
Registered: Sep 2005
Location: Ontario
Distribution: Debian, Ubuntu
Posts: 33

Original Poster
Rep: Reputation: 15
I was thinking about this the other day. I've improved it to:
Code:
alias 'kk'='konqueror "`pwd`"'
This is more efficient, as it allows konqueror to load directories with spaces in it. That was a problem last time.
 
  


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
Redirecting output of background processes after they've been started (BASH) DaneM Programming 18 08-08-2011 09:03 PM
Redirecting mplayer output driptray Linux - Software 1 10-12-2004 07:42 AM
getting custom PWD in bash prompt techrolla Linux - Software 2 08-09-2004 12:39 AM
Redirecting URL to another server wilcoNL Linux - Software 3 04-05-2004 07:00 AM
redirecting xmms output durden2.0 Linux - Software 0 03-06-2004 07:29 PM


All times are GMT -5. The time now is 04:43 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