Skip to main content
deleted 3 characters in body; added 4 characters in body
Source Link
MattyV
  • 845
  • 1
  • 6
  • 5

Add the following to your /etc/bashrc file. This script adds a resident "function" instead of an alias called "confirm".


function confirm( )
{
#alert the user what they are about to do.
echo "About to $@....";
#confirm with the user
read -r -p "Are you sure? [Y/n]" response
case $response"$response" in
    [yY][eE][sS]|[yY]) 
              #if yes, then execute the passed parameters
               $@;"$@"
               ;;
    *)
              #Otherwise exit...
              echo "ciao...";"
              exit;exit
              ;;
esac
}

Add the following to your /etc/bashrc file. This script adds a resident "function" instead of an alias called "confirm".


function confirm( )
{
#alert the user what they are about to do.
echo "About to $@....";
#confirm with the user
read -r -p "Are you sure? [Y/n]" response
case $response in
    [yY][eE][sS]|[yY]) 
              #if yes, then execute the passed parameters
               $@;
               ;;
    *)
              #Otherwise exit...
              echo "ciao...";
              exit;
              ;;
esac
}

Add the following to your /etc/bashrc file. This script adds a resident "function" instead of an alias called "confirm".


function confirm( )
{
#alert the user what they are about to do.
echo "About to $@....";
#confirm with the user
read -r -p "Are you sure? [Y/n]" response
case "$response" in
    [yY][eE][sS]|[yY]) 
              #if yes, then execute the passed parameters
               "$@"
               ;;
    *)
              #Otherwise exit...
              echo "ciao..."
              exit
              ;;
esac
}
Source Link
MattyV
  • 845
  • 1
  • 6
  • 5

Add the following to your /etc/bashrc file. This script adds a resident "function" instead of an alias called "confirm".


function confirm( )
{
#alert the user what they are about to do.
echo "About to $@....";
#confirm with the user
read -r -p "Are you sure? [Y/n]" response
case $response in
    [yY][eE][sS]|[yY]) 
              #if yes, then execute the passed parameters
               $@;
               ;;
    *)
              #Otherwise exit...
              echo "ciao...";
              exit;
              ;;
esac
}