Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Thanks to all your guys help this is what I have now;</p> <pre><code>for i in $(seq -w $1 $2); { echo "test-$i =&gt; test-$((10#$i+$3))" } #for </code></pre> <p>and this is the output I get when I run ./script.sh 01 10 220 for example;</p> <pre><code>test-01 =&gt; test-221 test-02 =&gt; test-222 test-03 =&gt; test-223 test-04 =&gt; test-224 test-05 =&gt; test-225 test-06 =&gt; test-226 test-07 =&gt; test-227 test-08 =&gt; test-228 test-09 =&gt; test-229 test-10 =&gt; test-230 </code></pre> <p>This was exactly what I wanted to achieve. Thanks a lot to "Robin Green" and "gniourf_gniourf".</p> <p>and now moving of directories work correctly ^_^</p> <pre><code>mv -v "temp/test-$i" "temp/test-$((10#$i+$3))" </code></pre> <p>output of moved directories is;</p> <pre><code>‘temp/test-01’ -&gt; ‘temp/test-221’ ‘temp/test-02’ -&gt; ‘temp/test-222’ ‘temp/test-03’ -&gt; ‘temp/test-223’ ‘temp/test-04’ -&gt; ‘temp/test-224’ ‘temp/test-05’ -&gt; ‘temp/test-225’ ‘temp/test-06’ -&gt; ‘temp/test-226’ ‘temp/test-07’ -&gt; ‘temp/test-227’ ‘temp/test-08’ -&gt; ‘temp/test-228’ ‘temp/test-09’ -&gt; ‘temp/test-229’ ‘temp/test-10’ -&gt; ‘temp/test-230’ </code></pre> <p>Problem only occurs when I run; ./script.sh 01 10 0 this is the output I get;</p> <pre><code>test-01 =&gt; test-1 test-02 =&gt; test-2 test-03 =&gt; test-3 test-04 =&gt; test-4 test-05 =&gt; test-5 test-06 =&gt; test-6 test-07 =&gt; test-7 test-08 =&gt; test-8 test-09 =&gt; test-9 test-10 =&gt; test-10 </code></pre> <p>as you can see no leading zeros =(</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload