The Cookie Machine - Click here to drag window

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

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

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: November 24, 2022    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
⇧ Different colors for active/inactive Unity window title bars? Is it possible to schedule `fsck` command and run it in background?  ⇩