Skip to content

Instantly share code, notes, and snippets.

@azureru
Last active November 9, 2017 10:21
Show Gist options
  • Save azureru/d4283c288e4b1ae2b984d6f420f72552 to your computer and use it in GitHub Desktop.
Save azureru/d4283c288e4b1ae2b984d6f420f72552 to your computer and use it in GitHub Desktop.
Feeding FTP using Image from Internet
#!/bin/bash
wget https://image
ftp -n <<EOF
open ftp.example.com
user user secret
put my-local-file.txt
EOF

Common Vars

echo $SHELL         # the shell
echo $BASH_VERSION  # bash version
echo $$             # pid of current process
echo $!             # pid of recently invoked background job
echo $?             # exit code of previously executed command

Basic

VAR=value                        # set var
export VAR=value                 # export the value - will be available on sub-processes
VAR="String"                     # string quoted
echo ${#VAR}                     # length of string

Get Param / Args

#blah.sh param1 param2 param3 param4 param5
echo $0 # path of script calling
echo $1 # param1
echo $2 # param2

If

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment