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

Re: pasting text into bash without use of mouse



on Wed, Apr 04, 2001 at 08:50:56AM +0800, 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?

...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)

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.

Cheers.

-- 
Karsten M. Self <kmself@ix.netcom.com>    http://kmself.home.netcom.com/
 What part of "Gestalt" don't you understand?       There is no K5 cabal
  http://gestalt-system.sourceforge.net/         http://www.kuro5hin.org

Attachment: pgpzIzScm1MW0.pgp
Description: PGP signature


Reply to: