28 lines
671 B
Bash
28 lines
671 B
Bash
#!/bin/bash
|
|
|
|
function confirm()
|
|
{
|
|
echo -n "$@ "
|
|
read -e answer
|
|
for response in y Y yes YES Yes Sure sure SURE OK ok Ok
|
|
do
|
|
if [ "_$answer" == "_$response" ]
|
|
then
|
|
return 0
|
|
fi
|
|
done
|
|
|
|
# Any answer other than the list above is considered a "no" answer
|
|
return 1
|
|
}
|
|
|
|
if [[ -d $HOME/.session ]]; then
|
|
echo $HOME/.session folder already exists
|
|
confirm "!overwrite??? (y/n)" || exit
|
|
/bin/cp -r -f $HOME/.session/ $HOME/.session-saved/
|
|
echo saved copy first to $HOME/.session-saved
|
|
fi
|
|
echo copying .session from $(pwd) to $HOME
|
|
/bin/cp -r -f .session/ $HOME
|
|
echo setting execute permissions
|
|
chmod +x $HOME/.session/* |