1
0
Fork 0

Ajout de quoi gérer l'appel au script depuis n'importe où de manière contrôlée

This commit is contained in:
trotFunky 2017-11-21 23:23:43 +01:00
parent 46c6dfc830
commit ca2bf3eba1

View file

@ -1,12 +1,21 @@
#! /bin/bash
if [ $# -eq 0 ]; then
name=packages_state
else
name=packages_state
location="$HOME/SYS_SAVES/"
if [ $# -ne 0 ]; then
if [ ! -z "$1" -a "$1" != "here" ]; then
name=$1
fi
if [ "$2" = here -o "$1" = here ]; then
location="."
elif [ ! -z "$2" ]; then
echo "Second argument can be void or 'here' only"
exit
fi
fi
cd $location
pathName="$name""_$(date +'%Y-%m-%d @ %Hh%M')"
mkdir "$pathName"