Artificial intelligent assistant

How do I change the input of a script to be the first argument on the CLI? I have a script called rename, and where it states `./wid_*.jil` I want to be able to enter that information from the command line while executing the script. for file in ./wid_*.jil do mv -i "${file}" "${file/orig/update}" done On the command line I would like to be able to enter [user@location dir1]$ rename dir2/ The script would then look in `dir2/` and rename all files with `orig` in their name to `update`. I'm very new to unix/linux so I apologize if my terminology is off, or if my description is poor.

$1 will be the first argument of your bash script:


#!/bin/bash

directory="$1"

echo "$directory"


You can also perform some checks, e.g.


#!/bin/bash

directory="$1"

[ -z "$directory" ] && echo "Please provide a directory" && exit 1
[ ! -d "$directory" ] && echo "Directory not found" && exit 2

for file in "$directory"/wid_*.jil
do
mv -i "${file}" "${file/orig/update}"
done

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 194ac2b7543c3a5cd76ed484fb69dbbc