[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: pasting text into bash without use of mouse



On Wednesday 04 April 2001 09:41, Karsten M. Self wrote:
> csj (csj@mindgate.net) wrote:
> > Is there a way to copy or paste text into bash without the use of
> > a mouse? I'm thinking of a text file "file.txt" which contains
> > command sequences which I would like to touch up before running.
> >
> > I don't want to use an editor for this. Just the line editing
> > functions of bash. Offhand the only (untested) solution I can
> > think of is something like "cat file.txt >> .bash_history",
> > subsequently invoking another bash session. Is this stupid
> > (dangerous)? Does someone have a better solution?
>
> Just posted here this week.  If you have wmaker installed, wxpaste
> and wxcopy do what you'd expect them to.

It looks interesting. But I forgot to add: --without-X. For those 
dire moments when X crashes.

On Wednesday 04 April 2001 09:49, Karsten M. Self wrote:
> ...another option.  If you're just trying to execute a set of
> commands through bash:
>
>     $ . <file>		# "source" commands in file, current shell
>     $ bash -f <file>	# run commands in file (subshell)
>     $ bash  < <file>	# run commands in file (subshell)

My version is something like "cat file.txt | bash". Is this a bad 
idea.

> If you want to compose multi-line commands to run in bash without
> creating an explicit file:
>
>     $ set -o vi		# set 'vi' mode
>     $ <esc>-v		# invoke 'vi' editor
>     # edit file, 'ZZ' or ':wq' when done.  Commands execute.

Hmm, does this really mean I have to really vi? Actually I was 
thinking of something like "cat file.txt > /dev/ttyX" which however 
pastes the thing not just on the screen but on the command line 
itself. Is there such a linuxian function?



Reply to: