I have a bunch of custom commands. One is called Shut
. I use it to automate some tasks before shutting down my PC.
#!/bin/bash
. Load
Stop
Update
Install
SpecialCommands
sudo shutdown -h now
And when I run it, I get (standard_in) 2: syntax error
for the Stop
command. This is my Stop
command:
#!/bin/bash
sudo echo
. Load
clear
Divide
Info "Stopping all ..."
Divide
for i in $(docker ps -a -q --filter name=$1);
do
export Name=$(docker container inspect $i | grep "Name.*/" | cut -d'/' -f2 | cut -d'"' -f1)
docker rm $i --force 1>/dev/null
Check $Name
done
docker system prune --force 1>/dev/null
Divide
Success "Stopped all"
Divide
Basically Stop
command stops all of the docker containers and cleans the system.
If I change it to bash Stop
then I won’t get that error.
I searched and almost all posts were related to bc
command. I’m not using bc
. What could be the reason?
Please tell me if you need more data. Thanks.
Update: My Load
command basically loads a bunch of shell scripts that contain functions to be accessible to commands:
for ScriptFile in /HolismHolding/Scripts/**;
do
if [[ $ScriptFile == *Python* ]]; then
continue;
fi
. "$ScriptFile"
done
For example, it loads my Message
script that includes these functions:
#!/bin/bash
red=""
green=""
cyan=""
magenta=""
yellow=""
reset=""
if [[ -t 1 ]]; then
red=`tput setaf 1`
green=`tput setaf 2`
cyan=`tput setaf 6`
magenta=`tput setaf 5`
yellow=`tput setaf 3`
reset=`tput sgr0`
fi
Check="xE2x9Cx94"
function Check()
{
echo -e "${green}$*;$Check${reset}" | column -t -s ';'
}
function Success()
{
echo "${green}$*${reset}"
}
function Info()
{
echo "${cyan}$*${reset}"
}
function Warning()
{
echo "${yellow}$*${reset}"
}
function Error()
{
echo "${red}$*${reset}"
}
function Divide()
{
echo
echo "${magenta}----------${reset}"
echo
}