MAKE A COPY PASTE OF THIS INTO CLIPBOARD MANAGER
##############################################
If you like to keep your copy/paste in a clipboard manager and you like copy pasteable scripts this is for you. I use CLCL (windows app) that I store many copy pasteable scripts (or commands that I can run on a linux server – via putty/ssh/telnet connection, these commands I run often so instead of working out my fingers and typing them out, its easier to just copy paste.)
Want to make a script that you can copy paste into a shell and it makes files for you. We use EOF to mean the end but you can put anything else there at the << and at the bottom, not just EOF.
SYNTAX:
cat > file << EOF
(body goes here, make sure to escape special characters, and dont include these parenthesis)
EOF
Note so far I have only encountered $ to be special characters that need escaping but I bet !! are as well and also * and ?.
For example:
=============
Here is the normal script. This is the hpaste script from my pastebin hastebin script (use the search at top for hastebin to find it – too lazy to include the link right now)
NORMAL:
#!/bin/bash
url=”http://ec2.infotinks.com:7777″
key=”$(curl –silent –insecure –data-binary @/dev/fd/0  $url/documents | cut -d “\”” -f 4)”
echo $url”/”$key
Let escape all of the special characters which I think are just the $
COPY PASTE:
#!/bin/bash
url=”http://ec2.infotinks.com:7777″
key=”\$(curl –silent –insecure –data-binary @/dev/fd/0  \$url/documents | cut -d “\”” -f 4)”
echo \$url”/”\$key
Here it is all finished. I added chmod to make it executable after.
THE REST OF THE COPY PASTE:
cat > /usr/bin/hpaste << EOF
#!/bin/bash
url=”http://ec2.infotinks.com:7777″
key=”\$(curl –silent –insecure –data-binary @/dev/fd/0  \$url/documents | cut -d “\”” -f 4)”
echo \$url”/”\$key
EOF
chmod +x /usr/bin/hpaste
Afterwards see what came out and make sure it has all of the proper character.
cat /usr/bin/hpaste
#!/bin/bash
url=”http://ec2.infotinks.com:7777″
key=”$(curl –silent –insecure –data-binary @/dev/fd/0  $url/documents | cut -d “\”” -f 4)”
echo $url”/”$key

Leave a Reply

Your email address will not be published. Required fields are marked *