Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Plugin User Scripts, User Input (nicht) möglich ?

Featured Replies

  • Community Expert

Hallo zusammen,

 

ich habe das Plugin "User Scripts" installiert, nun habe ich mich heute mal versucht, ein Script zu schreiben, das nur manuell im Vordergrund ausgeführt wird und auf eine Eingabe meinerseits warten soll:

#!/bin/bash
# fullname="USER INPUT"
read -p "Enter fullname: " fullname
# user="USER INPUT"
read -p "Enter user: " user

 

Leider rauscht das durch, ohne auf eine Eingabe zu warten. Deshalb meine Frage: Mache ich etwas falsch, oder ust das mit UserScripts einfach nicht möglich ?

 

Gruß, Jürgen

Solved by Squid

  • Solution

Doesn't work like that.   There is no stdinput to read from.  You can have the system pop up with a request to enter in arguments

 

 

  • Author
  • Community Expert

Danke! Ich werde mir das mal anschauen!

  • 5 months later...

Moin

Hast du dafür eine Lösung gefunden? Ich habe bisher noch nicht rausgefunden, wie ich eine simple ja/nein Abfrage hinbekomme...

Grüße

Thorsten

  • Author
  • Community Expert
1 hour ago, Tom7320 said:

Hast du dafür eine Lösung gefunden?

Nein, das geht nicht, siehe Solution

Ah. Danke. Ich las das "You can have the system pop up with a request to enter in arguments" so, dass es ggf. doch möglich sei...

22 hours ago, Tom7320 said:

Ah. Danke. Ich las das "You can have the system pop up with a request to enter in arguments" so, dass es ggf. doch möglich sei...

Natürlich geht das mit User Scripts:

#!/bin/bash
#arrayStarted=true
#foregroundOnly=true
#clearLog=true
#argumentDescription=Was ist?
#argumentDefault=Bla

echo argument="$1"

Aufruf des User Scripts:

{1B31CD62-F1A1-40A4-B79A-51D07875A035}.png

Default Argument "Bla" durch den Text "Nix" ersetzt:

{8FD34483-934D-4362-BAF6-0EB202942BF0}.png

Edited by hawihoney

Aaahhhhh. Alles klar. Danke! Das geht aber nur 1x pro Script, richtig?

PS: Ich glaube, ich beginne zu verstehen. Mehrere Argumente, durch Leerzeichen getrennt, gehen, genau wie beim direkten Aufruf in der Bash. Die finden sich dann in $1, $2, $3 usw. im Script wieder, korrekt?

Ok. Habe es selbst herausgefunden. Hier als Beispiel ein super simples Beispielscript, das sowohl im Vordergrund mit Abfrage der Parameter beim Benutzer funktioniert, als auch im Hintergrund mit Defaultparametern:

#!/bin/bash
#arrayStarted=true
#clearLog=true
#argumentDescription=Syncoid to external drive: src_dataset dst_dataset
#argumentDefault=tank backup01/unraid

args=($1)
src=${args[0]}
dst=${args[1]}

if [ -z "$src" ]; then
  src="tank"
fi

if [ -z "$dst" ]; then
  dst="backup01/unraid"
fi

echo "Syncoid from "$src" to ${dst%%/*} ("$dst")..."

if zpool import ${dst%%/*}; then
  /usr/local/sbin/syncoid --recursive --skip-parent --no-sync-snap --delete-target-snapshots \
    --exclude=tank/system \
    --exclude=tank/isos \
    $src $dst
  zpool export ${dst%%/*}
else
  echo "Error: no backup device found"
fi

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.