Elias0xbb / Jamf-Lehrer-Script

Jamf Jamf
2 stars 0 forks source link

Bash script to start the program #58

Open Elias0xbb opened 3 years ago

Elias0xbb commented 3 years ago

Beschreibung: Bash script hinzufügen, dass das Programm ausführt und welches bestimmte config werte setzen kann.

Beispiel wie man es ausführen können sollte: ./exec.sh -setauth "username:password"

Dowo2987 commented 3 years ago

fucking bash ist grauenvoll ${{$??x*}<<#"$?XZ"°asd°}

Dowo2987 commented 3 years ago

fucking github lässt mich nicht mein script hochladen hreu

Dowo2987 commented 3 years ago
#!/bin/bash
DEBUG=false

#with help from https://stackoverflow.com/questions/5474732/how-can-i-add-a-help-method-to-a-shell-script:
display_help_page() {
    echo "$(basename "$0"): A simple script to test different concepts for processing arguments passed to a script."; #basename simply removes all directory paths from a given file path
    echo "Options:"
    echo "  [-h|--help]     Displays this page"
    echo "  [-e|--echo] text    Echo the specified text. Use quotes if the text contains any whitespaces" 
}

arguments=("$@")
argument_count="$#"

if [ "$DEBUG" = true ]
then echo "Received $argument_count arguments";
fi

process_argument_no() {
    case "${arguments[$1]}" in 
        -h|--help) display_help_page;;
        -e|--echo) echo "${arguments[$1 + 1]}";; 
        *) echo "$(basename "$0"): Invalid Option '${arguments[$1]}'"; echo "Please try '$(basename "$0") -h' for more information.";; 
    esac
}

for (( i=0; i<argument_count; i+=2))
do {
    process_argument_no $i;
} done

das konnte ich produzieren bin stolz jetzt kommt das richtige script

oh und bitte nicht versuchen das zu verstehen "$@"??#<A

Dowo2987 commented 3 years ago

Habe jetzt script zum Starten hinzugefügt und in den branch startup-script commited Habe auch noch ein script was das Bashscript zum Starten zum PATH des aktuellen users hinzufügt falls jemand daran Interesse hat