Skip to content

bash

TODO

How to save command as variable

x=`{pwd}`
echo $x

Append Path

export PATH="your-dir:$PATH"

Load .env file

if [ -f .env ]
then
  export $(cat .env | sed 's/#.*//g' | xargs)
fi
while getopts u:a:f: flag
do
    case "${flag}" in
        P) repo_path=${OPTARG};;
        a) age=${OPTARG};;
        f) fullname=${OPTARG};;
    esac
done

Remove all non ASCII characters in all files in folder

for file in *; do 
    if [ -f "$file" ]; then 
         mv $file $(echo `$file` | sed -e 's/[^A-Za-z0-9._-]/_/g')
    fi 
done
rsync -avzhe ssh --progress dentropy@192.168.2.8:/home/dentropy/dentropycloud-traefik/apps/qbitttorrent/config/downloads .