PC & IT SUPPORT MADE EASY FORUM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

BASH PROGRAM EXPORTER SCRIPT

Go down

BASH PROGRAM EXPORTER SCRIPT Empty BASH PROGRAM EXPORTER SCRIPT

Post by jamied_uk 27th April 2021, 20:48

VID

Export Program Script (c) J~Net 2021
jnet.sytes.net

This script will copy the program if the program exists. (To current folder).

If it does not exist it will attempt to install it!


Example Usage:



Code:
./export.sh gobuster



Code

Code:
#!/bin/bash
# (c) J~Net 2021
# jnet.sytes.net
#
# https://jnet.forumotion.com/t1736-bash-program-exporter-script#2687
#
# ./export gobuster
#
program="$1"
dir=`pwd`
installed=`which $program`

echo "Checking For $program (Check 1 of 2)"

FILE=$installed
if [ -f "$FILE" ]; then
    echo "$FILE Exists."
else
    sudo apt install -y $program
fi

echo "Checking For $program (Check 2 of 2)"

if [[ $installed ]]
then
  echo "$installed Installed"
  sudo cp $installed $dir
  echo "Copyied to current folder"
else
  echo "$program Not Installed"
  sudo apt install -y $program
fi
jamied_uk
jamied_uk
Admin

Posts : 3053
Join date : 2010-05-09
Age : 41
Location : UK

https://jnet.sytes.net

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum