Learning Scripting

About writing shell scripts and making the most of your shell
Forum rules
Topics in this forum are automatically closed 6 months after creation.
Locked
lightwing

Learning Scripting

Post by lightwing »

What would be the Linux Mint equivalent of something like Windows Powershell? I'd like to start getting my hands dirty with scripting on something other than Windows.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
xenopeek
Level 25
Level 25
Posts: 29510
Joined: Wed Jul 06, 2011 3:58 am

Re: Learning Scripting

Post by xenopeek »

The default shell on Linux Mint is bash. You can install other shells and you can use other scripting languages. Here is a good guide on the Linux command line and scripting: http://en.flossmanuals.net/command-line/. This explains how to access builtin help and documentation for commands as well. Once you've made your way through that go on to http://mywiki.wooledge.org/BashGuide and http://mywiki.wooledge.org/BashFAQ.
Image
lightwing

Re: Learning Scripting

Post by lightwing »

Once upon a time, I had a linux class in college (Red Had 9). Most of the basics have stuck around, but some of the more obscure stuff is long since gone. Those should be a good help. Thanks for the pointers!

Do you happen to know if there are any sites where people request scripts and coding for certain things? Sometimes I have trouble finding a place to start while staring at my computer.
Habitual

Re: Learning Scripting

Post by Habitual »

How to write a Bash shell script - by example
is an excellent resource, but I'm partial. ;)

We could throw 100s of links at you and it's be pointless.
What do you want to do in the shell?
lightwing

Re: Learning Scripting

Post by lightwing »

Habitual wrote:How to write a Bash shell script - by example
is an excellent resource, but I'm partial. ;)
Haha, I got ya. Thanks for the input.
We could throw 100s of links at you and it's be pointless.
What do you want to do in the shell?
I know it's an irrationally broad request, and for that I apologize. What do I want to do? I have no idea. Well, let's say, at work I'm working on a powershell script to dump all user's permissions to any given folder (recursive directory tree) based on all group memberships, even nested, to an access db. Eventually I'm going to convert it to a SQL DB.

I don't have any reason to do that on my personal device, but I guess building something similar in bash might be a decent direction to start and a good learning exercise. Really, I'm at the point where I don't even know where to start (learning by doing, is a curse of mine, I suppose), hence the thread.

What's a typical system admin task a lot of people script? Automate a daily scan of event logs for disk errors? That's probably more realistic place to start. :oops:
lightwing

Re: Learning Scripting

Post by lightwing »

Here's an easy one. Are there any decent scripting environment applications available (I guess they're generally called IDEs?) that allow running a script selection for testing purposes, syntax highlighting, variable tracking and such?
Habitual

Re: Learning Scripting

Post by Habitual »

lightwing wrote:I know it's an irrationally broad request, and for that I apologize. What do I want to do? I have no idea. Well, let's say, at work I'm working on a powershell script to dump all user's permissions to any given folder (recursive directory tree) based on all group memberships, even nested, to an access db. Eventually I'm going to convert it to a SQL DB.

I don't have any reason to do that on my personal device, but I guess building something similar in bash might be a decent direction to start and a good learning exercise. Really, I'm at the point where I don't even know where to start (learning by doing, is a curse of mine, I suppose), hence the thread.

What's a typical system admin task a lot of people script? Automate a daily scan of event logs for disk errors? That's probably more realistic place to start. :oops:
Apology not accepted.
One Linux utility for "get all users perms" is getfacl
I have a Mantra (A-oooooooooooooooooom).
If I have to type it more than 3 times in 1 day, It becomes a script.
My College DOS professor gave me that advice.
True in DOS. True+ in Linux.
Linux is just DOS on steroids.

What do you find youself repeatedly "doing" in the shell that caused you to get started?
Here's a process-driven task you need to master.
Automate backups of your personal data.
Have enough storage to learn that?

Write the script. Debug, Once it runs on it's own.
We'll automated the process via cron.

If you are "looking for errors" on a Linux machine, you could be here awhile.
Have one specific in mind?
Last edited by Habitual on Sat Aug 20, 2016 8:45 am, edited 1 time in total.
lightwing

Re: Learning Scripting

Post by lightwing »

Habitual wrote: Apology not accepted.
Tough crowd. :wink:
One Linux utility for "get all users perms" is getfacl
If i'm understanding the getfacl man page and --help correctly, that's not exactly it, but it's cool. Look up Hyena AD Group Management or Dumpsec...something like that, only much simpler. Windows is my day job....Linux is for fun.
I have a Mantra (A-oooooooooooooooooom).
If I have to type it more than 3 times in 1 day, It becomes a script.
My College DOS professor gave me that advice.
True is DOS, true+ in Linux.
Linux is just DOS on steroids.

What do you find youself repeatedly "doing" in the shell that caused you to get started?
Here's a process-driven task you need to master.
Automate backups of your personal data.
Have enough storage to learn that?

Write the script. Debug, Once it runs on it's own.
We'll automated the process via cron.

If you are "looking for errors" on a Linux machine, you could be here awhile.
Have one specific in mind?
Nothing specific in mind yet. All good pointers. I appreciate the info. I need to spend some more time with this to figure out what kinds of things I want to automate for myself. Guess I'll hang out and see what kinds of things other people are asking about. That might help too.
Habitual

Re: Learning Scripting

Post by Habitual »

Get all user perms from where, Linux or Windows?
You want to poll/collect/inspect Windows perms from your Linux host?
lightwing

Re: Learning Scripting

Post by lightwing »

Habitual wrote:You want to poll/collect/inspect Windows perms from your Linux host?
No, nevermind. I'm probably giving too much info and causing confusion.
Chiefahol

Re: Learning Scripting

Post by Chiefahol »

lightwing wrote:What would be the Linux Mint equivalent of something like Windows Powershell? I'd like to start getting my hands dirty with scripting on something other than Windows.
Python is #1 for scripting IMO.
Locked

Return to “Scripts & Bash”