0

I'm new to Bash scripts.

I have this script

@echo off&&powershell -NoE -c "&{ipmo activedirectory; set-adaccountpassword (read-host 'user') -R}"

this script is running connecting to AD and then it's asking for the user and then I can reset a password for the user that I will type and then the script ends.

can someone help to do run this screen in a loop until I will type "done"?

thnaks

1 Answers1

0

Loop are design to run repetitive tasks. To have interrupt from the user you may create do while loop and try to keep a condition check on while statement with your done condition. Check this question and posted answer for do while concept emulating-a-do-while-loop-in-bash

kashif
  • 68
  • 7
  • Hi, I don't have any experience with bash can you help me? – Alexxx55555 Mar 24 '22 at 17:11
  • @Alexxx55555 in above comment i have given link which has good examples. One of the example : ** #!/bin/bash while [[ $STATUS != 0 ]] ssh-add -l &>/dev/null; STATUS="$?" if [[ $STATUS == 127 ]]; then echo "ssh not instaled" && exit 0; elif [[ $STATUS == 2 ]]; then echo "running ssh-agent.." && eval `ssh-agent` > /dev/null; elif [[ $STATUS == 1 ]]; then echo "get session identity.." && expect $HOME/agent &> /dev/null; else ssh-add -l && git submodule update --init --recursive --remote --merge && return 0; fi do true; done ** – kashif Mar 27 '22 at 03:29
  • Please upvote the post and suggestions if you are fine with the feedback – kashif Mar 27 '22 at 03:31
  • sorry no idea i just want to run this scriipt again can you help? – Alexxx55555 Mar 28 '22 at 19:45