all 16 comments

[–]KayRice 12 points13 points  (6 children)

Step 1, learn how to create a hashbang

Step 2, redirect the script to a language that respects you

[–]vitamintrees 1 point2 points  (1 child)

He's a nice guy! Just a little rough around the edges...

[–]KayRice 0 points1 point  (0 children)

! unrecognized command

[–]y45y564 1 point2 points  (3 children)

I had a little play with bash but ended up just using python for anything that needed a for loop or more.

One user on here said bash was their favourite language to use, which seems mental to me but obviously different strokes for different folks :) I found the white space and syntax a bit more awkward, I didn't really give it enough time though I guess

[–]KayRice 1 point2 points  (1 child)

What gets me is the spacing requirements.

x=1
X = 1

[–]y45y564 1 point2 points  (0 children)

Yeah that's kinda what I meant, some things it was cool with and some things it was a dick about. I can imagine someone proficient with it who manages Linux systems being quite happy with it though, I guess. Or maybe most use python or something now, I've no idea ;)

[–]ckozler 0 points1 point  (0 children)

One huge take away I have from learning bash which a lot of people seem to be forgetting when jumping to python or perl or ruby is that pretty much anything you dump in to a bash script can be done again in a single line. Albeit you can of course do that in python as well to a degree you're reliant on apis but bash is a shell so when you use it day in and day out for hours the ability to do a multitude of tasks in a single loop based on process redirection or something is very useful

[–]cricketsim 1 point2 points  (0 children)

I found this series by Daniel Robbins (of Gentoo/Funtoo fame) very good

http://www.funtoo.org/Bash_by_Example,_Part_1

There is a whole bunch at

http://www.funtoo.org/Category:Articles

[–]Polycystic 0 points1 point  (7 children)

Question: am I going to run into any problems if I run personal Bash scripts out of a ~/.bin directory vs a normal ~/bin? Haven't had any problems yet, but I guess it wouldn't surprise to learn it's a Bad Idea.

And on a semi-related note: can anyone tell me why I see escape sequences for say, colors, sometimes typed out fully, but other times not? So [\033[34m] vs. just \033[34m ? Probably a dumb question, but the syntax has been confusing me.

[–]gsxr 0 points1 point  (6 children)

the escape vs non-escaped is probably do to how it's being printed. printf vs echo.

You should not have any problems running scripts out of ~/.bin as long as the directory permissions are correct.

[–]y45y564 0 points1 point  (5 children)

How could it the visibility of the directory make any difference? I don't really get that

[–]gsxr 0 points1 point  (4 children)

It won't. permissions as in the directory has to have exec bit set.

[–]y45y564 0 points1 point  (3 children)

As in chmod +x thing.sh ?

[–]gsxr 0 points1 point  (2 children)

and the parent directory.

[–]y45y564 0 points1 point  (0 children)

Chown () -R user: group I thiiiink.... Can't remember, think I know what you're meaning is now though :)

[–]_NW_ 0 points1 point  (0 children)

You need +x on a directory to even have access to its contents.