summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSüleyman Fərəcli <suleyman@farajli.net>2025-06-19 01:19:02 +0400
committerGitHub <noreply@github.com>2025-06-19 01:19:02 +0400
commit4d14ace3c5180ec0827408c1222cb35fe27cf484 (patch)
tree5e0caad138af71bdb2d9c524b0f6fff87eee4443 /scripts
parent1eb90cf48629b8dfc0182cbe38b34c8082f4dc40 (diff)
parent4210338b4166f8f1c16bf30e72a69e11c098eea8 (diff)
Merge pull request #9 from sfarajli/dev
Dev
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/br4
-rwxr-xr-xscripts/nsend2
-rwxr-xr-xscripts/sdev8
-rwxr-xr-xscripts/slib7
4 files changed, 12 insertions, 9 deletions
diff --git a/scripts/br b/scripts/br
index 6802b75..8e55937 100755
--- a/scripts/br
+++ b/scripts/br
@@ -33,8 +33,8 @@ if [ "${#}" -eq 0 ]; then
[ -z "${link}" ] || "${browser}" "${link}"
-elif [ "${#}" -eq 1 ]; then
- [ "${1}" = "-h" ] && help
+elif [ "${#}" -eq 1 ]; then
+ [ "${1}" = "-h" ] && help
"${browser}" "${1}"
else
diff --git a/scripts/nsend b/scripts/nsend
index 7337b4d..5aef4fd 100755
--- a/scripts/nsend
+++ b/scripts/nsend
@@ -21,7 +21,7 @@ case "${1}" in
"-s")
[ "${#}" -gt 3 ] && invalid_use
- run "notify-send ${2} ${3}"
+ echo $(printf 'notify-send "%s" "%s"' "${1}" "${2}")
exit 0
;;
diff --git a/scripts/sdev b/scripts/sdev
index 22c1af5..39f22c5 100755
--- a/scripts/sdev
+++ b/scripts/sdev
@@ -50,13 +50,13 @@ check_program "xinput"
while getopts "e:d:t:lh" option; do
case "${option}" in
- e)
+ e)
get_id "${OPTARG}"
xenable "${id}"
;;
- d)
+ d)
get_id "${OPTARG}"
- xdisable "${id}"
+ xdisable "${id}"
;;
t)
get_id "${OPTARG}"
@@ -67,7 +67,7 @@ while getopts "e:d:t:lh" option; do
l)
if ! xinput list 2>/dev/null; then
err "Listing Failed"
- else
+ else
exit 0
fi
;;
diff --git a/scripts/slib b/scripts/slib
index 30e32ca..5ea05d6 100755
--- a/scripts/slib
+++ b/scripts/slib
@@ -15,7 +15,6 @@ argv0=$(basename "${0}")
# @EXAMPLE:
# err "Invalid usage" "Try '${argv0} -h' for help."
-
err() {
if [ "${1}" != "-x" ]; then
printf "%s: " "${argv0}"
@@ -32,7 +31,7 @@ err() {
# @FUNCTION: invalid_use
# USAGE: [-h]
# @DESCRIPTION:
-# Output a usage error message. If `-h` is not specified output:
+# Output a usage error message. If `-h` is not specified output:
# "<program>: Invalid usage "
# "Try 'program -h' for help."
# else output only:
@@ -72,6 +71,10 @@ check_program() {
# To add a failure message a success message must also be present.
# The output of the command is not suppressed.
#
+# This implementation does **not** use `eval`. Only simple commands and arguments are supported.
+# Shell control operators like `&&`, `||`, pipes (`|`), or redirection (`>`, `>>`, etc.) will not work.
+# This prevents unintended execution and makes it safe for use in scripts.
+#
# @EXAMPLE:
# Run xwallpaper command if success print out ${image}:
#