Official Useful Shell Scripts Thread

Zombie

Anbu Operative 🎭
Veteran
Joined
Oct 14, 2010
Messages
2,676
Reaction score
695
Introducing the Official Useful Shell Scripts Thread.

When submitting useful shell scripts, please use this format:
PHP:
Simple Name: "a simple name for easy finding"
Quick Description: "a quick description describing the function and purpose of your script"
[code]
#!/bin/bash
insert
    your code
done
[/code]
howto: describe how to use/modify your script
Output:
Simple Name: ie "rename images"
Quick Description: "change image names to incremental four number list"
Code:
#!/bin/bash
a=1
for i in *.jpg; do
  new=$(printf "%04d.jpg" ${a})
  mv "${i}" "${new}"
  let a=a+1
done
howto edit: Shouldn't take much to look at the above code to realize that if your images are .png's to change the *.jpg to .png (obviously you see another .jpg, if you'll want to change that too to or else your .pngs will be turned into .jpgs! and you'll also want to edit the %04d to change the amount of numbers created while naming.

Remember to always submit clean code and to run your .
 
Last edited:

HashiramaDescendant

Sannin of the Scrolls 📜
Elite
Joined
Mar 9, 2012
Messages
5,587
Reaction score
544
Computer language script writing stuff... Very interesting. :)
What exactly does it do?
 

Zombie

Anbu Operative 🎭
Veteran
Joined
Oct 14, 2010
Messages
2,676
Reaction score
695
Computer language script writing stuff... Very interesting. :)
What exactly does it do?
In bash, you can pretty much do anything and everything from executing programs to performing system maintenance such as clearing /var/logs on a daily or hourly basis. If you're interested in learning about bash scripting/programming, I'd highly suggest you read into GNU/Linux. I'm also always willing to answer questions, or clarify things as well.
 

HashiramaDescendant

Sannin of the Scrolls 📜
Elite
Joined
Mar 9, 2012
Messages
5,587
Reaction score
544
In bash, you can pretty much do anything and everything from executing programs to performing system maintenance such as clearing /var/logs on a daily or hourly basis. If you're interested in learning about bash scripting/programming, I'd highly suggest you read into GNU/Linux. I'm also always willing to answer questions, or clarify things as well.

Thanks, bro. :D
 
Top