0

I'm trying to make a simple script that copies a game file 10 times, renaming them 1-10 for when the game patches/updates. Otherwise I have to do it manually. I've been editing with sublime script and am not sure on how to debug or what I'm even doing wrong.

#!/bin/bash

wiz=1

mv /home/redking/.local/share/Steam/steamapps/common/Wizard101/Bin/WizardGraphicalClient.exe /home/redking/.local/share/Steam/steamapps/common/Wizard101
for wiz in 1 .. 10
do

if wiz >= 10
then wiz=1
else 
wiz+1
cp /home/redking/.local/share/Steam/steamapps/common/Wizard101/WizardGraphicalClient.exe /home/redking/.local/share/Steam/steamapps/common/Wizard101/Bin/$wiz.exe 
done
  • `if [ "$wiz" -ge 10 ]`, or `if (( wiz >= 10 ))` – Charles Duffy Feb 15 '23 at 16:29
  • And `(( wiz += 1 ))` or `(( ++wiz ))` -- you need to enter an arithmetic context to do math. – Charles Duffy Feb 15 '23 at 16:30
  • And `for (( wiz=1; wiz <= 10; wiz++ )); do` – Charles Duffy Feb 15 '23 at 16:30
  • which is to say -- read the docs for appropriate syntax, don't just make things up. – Charles Duffy Feb 15 '23 at 16:30
  • Sorry. im still really new and confused as to what documents I need to read, can you direct me? I don't wanna make another stupid post – spiritofbattle Feb 15 '23 at 16:45
  • There are a bunch of good recommendations linked from the bash tag info wiki at https://stackoverflow.com/tags/bash/info. I particularly recommend the [BashGuide](https://mywiki.wooledge.org/BashGuide), [BashFAQ](https://mywiki.wooledge.org/BashFAQ), and [BashPitfalls](https://mywiki.wooledge.org/BashPitfalls) pages. – Charles Duffy Feb 15 '23 at 16:52
  • Another useful resource to keep handy is http://shellcheck.net/; all the errors or warnings it can throw come with links to a wiki page going into more detail. – Charles Duffy Feb 15 '23 at 16:53

0 Answers0