mirror of
https://github.com/Mastermindzh/examples.git
synced 2025-09-02 22:14:31 +02:00
consolidation of various example repos/gists
This commit is contained in:
24
bash/parsing-command-line-params.sh
Normal file
24
bash/parsing-command-line-params.sh
Normal file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Allow params a b v
|
||||
# : is used to disable verbosity
|
||||
while getopts ":abv" opt; do
|
||||
|
||||
# case to handle scenarias
|
||||
case $opt in
|
||||
a)
|
||||
echo "-a passed, Parameter: $OPTARG"
|
||||
;;
|
||||
b)
|
||||
echo "-b passed, Parameter: $OPTARG"
|
||||
;;
|
||||
v)
|
||||
echo "-v passed, Parameter: $OPTARG"
|
||||
;;
|
||||
# default case
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
17
bash/remove-parentheses.sh
Normal file
17
bash/remove-parentheses.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
# will recursively remove ( and ) from all files
|
||||
|
||||
for d in /mnt/series/Smallville/*; do
|
||||
if [ -d "$d" ]; then
|
||||
echo ""
|
||||
echo "=> moving to: $d"
|
||||
cd "$d"
|
||||
for f in *.*; do
|
||||
echo "processing: $f"
|
||||
des=$(echo "$f" | tr -d '()')
|
||||
if [ "$f" != "$des" ]; then
|
||||
mv "$f" "$des"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
9
bash/whiptail.sh
Normal file
9
bash/whiptail.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
Height=$(tput lines)
|
||||
Width=$(tput cols)
|
||||
Height=$((Height / 2))
|
||||
Width=$(((Width * 2) / 3))
|
||||
|
||||
whiptail --yesno --title "Hello!" "This is a whiptail window" $Height $Width
|
||||
|
Reference in New Issue
Block a user