Grabs the location and name of the script file itself.

Member Avatar
Member Avatar
-1 forum 3

I'm no pro when it comes to BASH, but I have been known to shell-script my way out of a problem here and there. One of the useful things you can do is a for-loop, whether it be used on file names, script arguments, or just a string of words. Here are some very basic examples on how to do for-loops in BASH. Edit: Fixed per Watael's suggestions.

Member Avatar
Member Avatar
+0 forum 1

I'm no pro when it comes to BASH, but I have been known to shell-script my way out of a problem here and there. One of the useful things you can do is a for-loop, whether it be used on file names, script arguments, or just a string of words. Here are some very basic examples on how to do for-loops in BASH.

Member Avatar
Member Avatar
+0 forum 3

This is another useful script I came across. It prints a color-code chart in your terminal. It can help you find the color-code you are looking for, or view the current color-scheme you are using (people use it on reddit/r/unixporn to show off their system's theme, I use it to grab color codes). I figure someone may get some use out of this, and there aren't many "Shell Scripting" code-snippets, so I'll put it here.

Member Avatar
+0 forum 0

I didn't write this, the credits are in the code. It's a code-golf version, and I'm sorry about that. I am trying to 'decode' it but I don't have the skills, so the 'decoded' version doesn't have the right colors. This is an example of what you can do with BASH, or possibly other shells, and it's just a neat thing to see. So I offer this up for your amusement, I've tested it and combed through it to make sure there's no hidden tricks. As far as I can tell it only uses a few commands like `echo`, `printf`, …

Member Avatar
+0 forum 0

I ran across the need to view a specific line of a file so I wrote this up. You can view a line or a range of lines for a file or compare two files. Check the command for the syntax. Drop it in /usr/bin/sln and enjoy.

Member Avatar
Member Avatar
+0 forum 2

This code changes color of prompt according to user, suppose if user is root then color would be red and normal user would have color black. This'll diffrentiate in users.

Member Avatar
+0 forum 0

Here is a little spinner thing for the command line, used when your current bash script is waiting on a background/system process. The weird character is ^H or a backspace.

Member Avatar
Member Avatar
+0 forum 2

I know what your thinking, You and everyone else has always wanted a clock that sits at the top of your command prompt and tells you the time. Why ? I made this in first year when i spent countless hours programming and little in bed. I decided i needed somthing that told me all the things i needed to know in one easy location, the top of the screen.. So here it the pauls magical clock of sit on top of my screen. Sorry about the lack of comments and meaningful varible names, its quite a hacked together little …

Member Avatar
Member Avatar
+0 forum 1

The End.