06-01-2010
Thanks.
---------- Post updated at 01:39 PM ---------- Previous update was at 01:36 PM ----------
Quote:
Originally Posted by
bakunin
"VI command line editing mode". ;-)
[*]/ - search through command history (all regexps allowed)
bakunin
This is what I was looking for. Thanks.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I try to use the pattern substitution operators as documented in the O'Reilley "Learning the Korn Shell" but it doesn't seem to work as advertised.
This works all right:
var='Regular expressions rules!'
$ echo ${var//e/#}
R#gular #xpr#ssions rul#s!
The docs says that using !(expr)... (5 Replies)
Discussion started by: ripat
5 Replies
2. UNIX for Dummies Questions & Answers
HI ,
I forgot to redirect my op to a file.The op which is quite huge , thus printed on the screen.However bcoz of the limited viewing in the screenI can not see the whole of the output..
Is there anyway I can see the full op.My run takes half a day for finnishing ..So I am refraining... (1 Reply)
Discussion started by: bimukt
1 Replies
3. AIX
on a AIX sys i have been trying to get the mouse scroll wheel to page the terminal for about 2 yrs now on aixterm. any ideas. the below syntax does not work in aixterm but does work in xterm.
------------------------- this does not work in aixterm but does work in xterm,, with a cat Xdefult |... (2 Replies)
Discussion started by: nullwhat
2 Replies
4. Shell Programming and Scripting
Sorry for the duplicate thread this one is similar to the one in
https://www.unix.com/shell-programming-scripting/88132-awk-sed-script-read-values-parameter-files.html#post302255121
Since there were no responses on the parent thread since it got resolved partially i thought to open the new... (4 Replies)
Discussion started by: rajan_san
4 Replies
5. Shell Programming and Scripting
In the Korn shell is it possible to truncate a pattern like this: -
) ]]
So that it is not necessary to enter
8 times? (2 Replies)
Discussion started by: steadyonabix
2 Replies
6. Shell Programming and Scripting
I don't have my SysV bible with me currently and I can't remember how to change the amount of lines visible in my shell. Currently I can only scroll back to see the last 100 lines of stdout.
Any help is greatly appreciated.
blessings,
Tony <>< (2 Replies)
Discussion started by: port43
2 Replies
7. Shell Programming and Scripting
I figured this would be simple, but I am stuck.
Variable longpath="/dir1/dir2/dir3/filename.stuff.morestuff.garbage"
I want to end up with just "filename.extra.moreextra". So, I want to get rid of the path and .garbage
I want to do this with just ksh internals. So, no sed,grep,awk,expr,... (4 Replies)
Discussion started by: Topaz
4 Replies
8. UNIX for Dummies Questions & Answers
I figured out my question. mods please delete. Thank you (2 Replies)
Discussion started by: rpmischris
2 Replies
9. Shell Programming and Scripting
I have the need to check content of very many files for a block of text.
I know the data should match for instance/as an example the following
The list of characters
bugs bunny
tom and jerry
Mighty mouse
Felix the cat
/
In the first step, I isolated the interesting data by... (3 Replies)
Discussion started by: popeye
3 Replies
10. UNIX for Dummies Questions & Answers
Hello,
I am a beginner, I have currently Solaris 11 on a vmware machine. Whenever I type a command like 'ls' the screen scrolls to the end of the screen. I am unable to see the entire list of directories and files. I have tried ls |page command, but looking out for a better option. (3 Replies)
Discussion started by: farheenprasad
3 Replies
LEARN ABOUT CENTOS
shell-quote
SHELL-QUOTE(1) User Contributed Perl Documentation SHELL-QUOTE(1)
NAME
shell-quote - quote arguments for safe use, unmodified in a shell command
SYNOPSIS
shell-quote [switch]... arg...
DESCRIPTION
shell-quote lets you pass arbitrary strings through the shell so that they won't be changed by the shell. This lets you process commands
or files with embedded white space or shell globbing characters safely. Here are a few examples.
EXAMPLES
ssh preserving args
When running a remote command with ssh, ssh doesn't preserve the separate arguments it receives. It just joins them with spaces and
passes them to "$SHELL -c". This doesn't work as intended:
ssh host touch 'hi there' # fails
It creates 2 files, hi and there. Instead, do this:
cmd=`shell-quote touch 'hi there'`
ssh host "$cmd"
This gives you just 1 file, hi there.
process find output
It's not ordinarily possible to process an arbitrary list of files output by find with a shell script. Anything you put in $IFS to
split up the output could legitimately be in a file's name. Here's how you can do it using shell-quote:
eval set -- `find -type f -print0 | xargs -0 shell-quote --`
debug shell scripts
shell-quote is better than echo for debugging shell scripts.
debug() {
[ -z "$debug" ] || shell-quote "debug:" "$@"
}
With echo you can't tell the difference between "debug 'foo bar'" and "debug foo bar", but with shell-quote you can.
save a command for later
shell-quote can be used to build up a shell command to run later. Say you want the user to be able to give you switches for a command
you're going to run. If you don't want the switches to be re-evaluated by the shell (which is usually a good idea, else there are
things the user can't pass through), you can do something like this:
user_switches=
while [ $# != 0 ]
do
case x$1 in
x--pass-through)
[ $# -gt 1 ] || die "need an argument for $1"
user_switches="$user_switches "`shell-quote -- "$2"`
shift;;
# process other switches
esac
shift
done
# later
eval "shell-quote some-command $user_switches my args"
OPTIONS
--debug
Turn debugging on.
--help
Show the usage message and die.
--version
Show the version number and exit.
AVAILABILITY
The code is licensed under the GNU GPL. Check http://www.argon.org/~roderick/ or CPAN for updated versions.
AUTHOR
Roderick Schertler <roderick@argon.org>
perl v5.16.3 2010-06-11 SHELL-QUOTE(1)