In article <
19b164a4-d7e8-4534...@googlegroups.com>,
tod davis <
todw...@gmail.com> wrote:
...
>Thanks Jeff
>
>The string to be entered is actually the first part of a command so
>changing the prompt doesn't quite get me there. Maybe my first example
>was poor. How about this one...
>
>if I want to grep a file list, which we do al lot, i end up typing "ls
>-la | grep *something*" and the *something* changes. if i had an alias
>that would type the "ls -la | grep " for me, then i save a lot of key
>strokes over time
>
>thanks for the suggestion
I get what you want (I suspect some of the other posters did not), but,
alas, the normal Unix shells don't really speak to this sort of
interactivity. There isn't any facility in bash (or any other shell to the
best of my knowledge) to "push" characters into the input stream.
The Unix-shell-ish way is, as others have described, to make a function or
alias that does the first part of what you want, and then use that, passing
the additional args on the command line, but that doesn't have the visual
appeal of having the characters from the function or alias actually pushed
into the input stream and thus visible to you on the command line.
Note that you can get somewhere close to where you want to be, by using the
up arrow key and scrolling back through previous commands. You can also
search the history and bring up previous commands - using keystrokes that
depend on which editing more you are in. I use the vi mode, so for me, it
looks like:
$ set -o vi
$ <esc>/string2LookFor
But, my real suggestion in all of this, is to look into the 'fc' command.
This is a little known bash command that allows you to visually edit (in
full screen vi) a command or group of commands, and then execute them. I
have a feeling that that may work for you. You'll have to try it out and
get used to it - it is a little weird - but is pretty nice once you get
used to it.
--
Pensacola - the thinking man's drink.