From 4e375b5d088ce992bd31c42514f94c3517dc9bb8 Mon Sep 17 00:00:00 2001 From: Olli Graf Date: Tue, 28 Jan 2025 09:54:00 +0100 Subject: [PATCH] Schript zu Teil 20. --- alias/noalias.sh | 2 ++ alias/yesalias.sh | 3 +++ teil20/hello-shebang.py | 7 +++++++ teil20/hello.js | 4 ++++ teil20/hello.py | 9 +++++++++ teil20/mybang | 14 ++++++++++++++ 6 files changed, 39 insertions(+) create mode 100755 alias/noalias.sh create mode 100755 alias/yesalias.sh create mode 100755 teil20/hello-shebang.py create mode 100755 teil20/hello.js create mode 100755 teil20/hello.py create mode 100755 teil20/mybang diff --git a/alias/noalias.sh b/alias/noalias.sh new file mode 100755 index 0000000..72ca646 --- /dev/null +++ b/alias/noalias.sh @@ -0,0 +1,2 @@ + +ll diff --git a/alias/yesalias.sh b/alias/yesalias.sh new file mode 100755 index 0000000..cde11af --- /dev/null +++ b/alias/yesalias.sh @@ -0,0 +1,3 @@ +shopt -s expand_aliases # Aktiviert Aliase +alias ll='ls -la' +ll diff --git a/teil20/hello-shebang.py b/teil20/hello-shebang.py new file mode 100755 index 0000000..7259268 --- /dev/null +++ b/teil20/hello-shebang.py @@ -0,0 +1,7 @@ +#! ./mybang +def main(): + print("Hallo aus teil20!") + + +if __name__ == "__main__": + main() diff --git a/teil20/hello.js b/teil20/hello.js new file mode 100755 index 0000000..00824e4 --- /dev/null +++ b/teil20/hello.js @@ -0,0 +1,4 @@ +#! /usr/bin/node +// Datei: hello.js + +console.log('Hallo von JavaScript') diff --git a/teil20/hello.py b/teil20/hello.py new file mode 100755 index 0000000..2579beb --- /dev/null +++ b/teil20/hello.py @@ -0,0 +1,9 @@ +#! ./mybang +# Datei: hello.py + +def main(): + print("Hallo von Python") + + +if __name__ == "__main__": + main() diff --git a/teil20/mybang b/teil20/mybang new file mode 100755 index 0000000..61fbc3d --- /dev/null +++ b/teil20/mybang @@ -0,0 +1,14 @@ +#! /usr/bin/bash +# Datei: mybang + +echo "0:${0}" +echo "1:${1}" +echo "2:${2}" + +if [[ "${USER}" == "pi" ]]; then + echo "User pi darf python ausführen." + python ${1} +else + echo "Du darfst kein Python ausführen." +fi +