I want to know what's the command used in command "Xterm here" ? I used rxvt -e cd /usr/share , but it disappear immediately
thanks
What's the command for "Xterm here"?
cd /usr/share && rxvt
or
a=`pwd`;cd /usr && rxvt && cd $a&
If you want to run other commands like "ls":
If you use rxvt, you can use a wrapper:
Save as "/usr/local/bin/myrxvt"
Make it executable:
chmod 755 /usr/local/bin/myrxvt
Test it:
myrxvt ls
A new rxvt will open running your command.
The "read a" waits for a keypress before exiting.
You can achive this "inbuilt" with the "real" Xterm:
http://dotpups.de/dotpups/XServer/xterm.pup (313 kb)
Usage:
xterm -hold -e ls
Mark
or
a=`pwd`;cd /usr && rxvt && cd $a&
If you want to run other commands like "ls":
If you use rxvt, you can use a wrapper:
Code: Select all
#!/bin/bash
#------------------------------------------------
#-- start in a new console-window
#------------------------------------------------
if [ "$1" != "rxvt" ];then
rxvt -title bc -sb -cr green -bg yellow -geometry 30x10+200+200 -e $0 rxvt $@&
exit 0
fi
cmd=`echo $@|sed "s/^rxvt//"`
$cmd
read a
Make it executable:
chmod 755 /usr/local/bin/myrxvt
Test it:
myrxvt ls
A new rxvt will open running your command.
The "read a" waits for a keypress before exiting.
You can achive this "inbuilt" with the "real" Xterm:
http://dotpups.de/dotpups/XServer/xterm.pup (313 kb)
Usage:
xterm -hold -e ls
Mark
Small Diskmonitor:
Code: Select all
#!/bin/bash
#------------------------------------------------
#-- start in a new console-window
#------------------------------------------------
if [ "$1" != "rxvt" ];then
rxvt -title diskfree +sb -cr yellow -bg yellow -geometry 20x2+200+200 -e $0 rxvt&
exit 0
fi
#clear
a=`df -m | grep "/root" | sed "s/[^ ]*%.*$//" | sed "s/ *$//"| sed "s/[^ ]* //g"`
echo $a MB free on /root
sleep 10
exec $0 rxvt
I just did not find out how to suppress the linefeed, then you could make it just 1 line high.
Mark
terminal commands
Thanks for posting that example of using linux commands. Interesting and useful.
Stuff the result into a variable and output it using echo -nMU wrote:I just did not find out how to suppress the linefeed, then you could make it just 1 line high.
Here's my "improved" version, using awk not grep and sed for clarity, using variables not "magic numbers" for config settings, and allowing the user to specify which mountpoint to monitor.
Code: Select all
#!/bin/sh
# diskfree -- a minimalist disk freespace monitor using rxvt
RCFILE=".diskfreerc" # Name of per-user rc file
# Set default configuration
DEFAULTDIR="/root" # Default mount point
DELAY=10 # Seconds to delay between df invocations
DFFIELD=4 # Which field of df output to display
ROWS=1 # Height of terminal window in characters
COLUMNS=22 # Width of terminal window in characters
XOFFSET=200 # Horizontal offset of window
YOFFSET=200 # Vertical offset of window
BGCOLOR="yellow" # Window background color
CURSORCOLOR="$BGCOLOR" # Cursor color in window
FGCOLOR="black" # Window foreground (text) color
TERMINALPROG="rxvt" # Which terminal program to use
usage() { echo $0: Usage is $0 [ mountpoint ] ; exit 1 ;}
# Override defaults from rc file if present
[ -f ~/$RCFILE ] && . ~/$RCFILE
# Set mountpoint to monitor
DIR="$1"
[ -z "$DIR" ] && DIR="$DEFAULTDIR"
# The mountpoint really must be a directory
[ -d "$DIR" ] || usage
# cmd string is interpreted twice: in it initial creation and in rxvt sh
# Therefore, quoting and escaping really matters within it.
cmd="while true
do
# Extract the Available number from df output
available=\`df -m $DIR |awk '/^\// {print \$$DFFIELD}'\`
echo -ne '\n'\$available MB free on $DIR
sleep $DELAY
done"
#echo "cmd is $cmd"
# Now run terminal program and execute cmd within it
$TERMINALPROG -title "$DIR" +sb -cr $CURSORCOLOR -bg $BGCOLOR -fg $FGCOLOR \
-geometry ${COLUMNS}x${ROWS}+$XOFFSET+$YOFFSET -e sh -c "$cmd"