The Cookie Machine - Click here to drag window

DUMMY TEXT - Real text set in assets/js/theCookieMachine.js

If you can read me, I'm broken!

Views: 5,479     Votes:  1     ✅ Solution
Tags: command-line   bash   scripts  
Link: 🔍 See Original Answer on Ask Ubuntu ⧉ 🔗

URL: https://askubuntu.com/q/1189182
Title: How to automate the input of a password, in a custom batch file?
ID: /2019/11/16/How-to-automate-the-input-of-a-password_-in-a-custom-batch-file_
Created: November 16, 2019    Edited:  November 16, 2019
Upload: September 15, 2024    Layout:  post
TOC: false    Navigation:  false    Copy to clipboard:  false


You can take sudo out of your script and ensure users call the script using sudo scriptname.

Remove sudo -i line from your script and replace it with this:

# Must prefix with sudo when calling script
if ! [[ $(id -u) == 0 ]]; then
    echo You must call this script using sudo. Aborting.
    exit 99
fi
⇧ Different colors for active/inactive Unity window title bars? Is it possible to schedule `fsck` command and run it in background?  ⇩