Quickly creating a shell script

May 10th, 2011 § 0 comments

Suppose you want to create and run a short script. It’s often faster not to bother opening up a text editor. Instead, use shell history to write a file, then chmod and execute it:


$ cat > /tmp/me.py
#!/usr/bin/env python
print('hello world')
$ chmod a+x !$
chmod a+x /tmp/me.py
$ !$
/tmp/me.py
hello world
$

What's this?

You are currently reading Quickly creating a shell script at Dan O'Huiginn.

meta