Bug 131775 - Possibility for I/O Redirection in Konsole
Summary: Possibility for I/O Redirection in Konsole
Status: RESOLVED INTENTIONAL
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR wishlist
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-03 14:18 UTC by Dik Takken
Modified: 2008-03-18 02:54 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dik Takken 2006-08-03 14:18:19 UTC
Version:            (using KDE KDE 3.5.3)
Installed from:    Gentoo Packages
OS:                Linux

I often use Konsole in scripts and Kommander applications, to show the output of a command to the user, like this:

konsole -e <COMMAND>

Unfortunately, the script that runs Konsole cannot easily catch the output generated by the command. It is displayed in Konsole, but Konsole does not write the output to its stdout. Also, Konsole cannot take commands from stdin. 

My idea is that you can use Konsole like this:

uptime=$(konsole -e uptime)

which would have the same effect as just saying

uptime=$(uptime)

except for the fact that konsole shows the output of 'uptime' while it is running. Maybe Konsole could have a --outputredirection switch that suppresses the usual standard output generated by Konsole itself, and only output whatever appears in the running terminal.

The possibility to be able to pipe input into Konsole, and have Konsole redirect it to the running shell would also be very useful. You could then do this:

echo "ls" | konsole --outputredirection | sort > "filelist.txt"

Konsole will run the "ls" command, show the output to the user while also emitting it on stdout and exit when the "ls" command is finished.

A second form of input redirection that will be very useful should allow Konsole to act as a stream filter, like this:

ls | konsole -e cat /dev/stdin | sort > "sortedfilelist.txt"

This will pipe the output of "ls" to Konsole, Konsole redirects its stdin to the command that runs in its terminal window (cat /dev/stdin in this case) and duplicates the output of the command to its stdout.


It would be great if Konsole received some commandline switches for various forms of I/O redirection.
Comment 1 Robert Knight 2008-01-05 23:21:21 UTC
Why not tee the results of the command to a file and then just display the contents of the file, using any program which can display a text file.

eg.  

ls | tee sometempfile | sort > "sortedfilelist.txt"
konsole -e cat sometempfile

Or replace konsole with kwrite or something else in that last line.
Comment 2 Robert Knight 2008-03-18 02:54:33 UTC
Closing as I am assuming that comment #1 answered the reporter's need.