#!/bin/bash

# Verifica se o script é executado com privilégios de root
if [ "$(id -u)" -ne 0 ]; then
  echo "Este script precisa ser executado com privilégios de root."
  exit 1
fi

# Define as variáveis de instalação
APP_DIR="/usr/local/wifihashapp2"
BIN_DIR="/usr/local/bin"
DESKTOP_DIR="/usr/share/applications"

# Cria o diretório de instalação
mkdir -p "$APP_DIR"

# Copia os arquivos do aplicativo
cp -r ./* "$APP_DIR/"

# Cria um link simbólico para o executável do aplicativo
ln -s "$APP_DIR/main.py" "$BIN_DIR/wifihashapp2"

# Cria um atalho no menu de aplicativos (opcional)
cat > "$DESKTOP_DIR/wifihashapp2.desktop" <<EOL
[Desktop Entry]
Name=WifiHashApp2
Exec=wifihashapp2
Type=Application
Terminal=false
EOL

# Define as permissões adequadas
chmod -R 755 "$APP_DIR"
chmod +x "$BIN_DIR/wifihashapp2"

echo "WifiHashApp2 foi instalado com sucesso!" 
by

Online Bash Shell

Write, Run & Share Bash code online using OneCompiler's Online Bash Shell for free. It's one of the robust, feature-rich Bash shell available over online and getting started with the OneCompiler's Bash Shell is simple and pretty fast. The editor shows sample boilerplate code when you choose language as Bash. OneCompiler also has reference scripts, where you can look for the sample scripts and start coding.

About Bash

Bash (Bourne Again Shell) is a shell program written by Brian Fox and is an upgraded version of Bourne Shell program 'sh'.

Features

  • Open source GNU project
  • Read and execute the commands from a Shell Script
  • Can be invoked by either single-character command line options (-a, -b, -c, -i, -l, -r, etc. ) or by multi-character command line options also like --help, --debugger,--login, etc.
  • Consists of Key bindings
  • Available in restricted mode for the environment security
  • Contains one-dimensional arrays to manipulate the lists of data.

Syntax help

Variables

name="Foo"
echo $name
echo "$name"
echo "${name}"

Conditional Statements

If

if [ conditional-expression ]  
then  
statements  
fi  

If-else

if [ conditional-expression ]  
then  
   statements  
else  
  statements
fi  

Else-If

if [ conditional-expression ]  
then  
   statements  
elif [ conditional-expression ]  
then  
 statements  
else  
  statements
fi