You are not logged in.

#1 2015-12-12 17:59:17

jbodhorn
Member
Registered: 2015-12-11
Posts: 130

bash scripting

I've recently gotten to the point where I'd like to learn some scripting and programming. I've gotten a book from the library, python for kids, and I've been picking away at it. I need something a bit more in-depth and meant for bash. If anyone has some recommendations I'd appreciate them

I've used a few scripts in the past that I've had to edit to make them work for me, but they were clearly marked where I needed to edit and what to put in, if not for that I'd have been unsuccessful at using them. Sometimes, like last night I was looking at at some scripts for mounting cifs and it was like I was looking at a foreign language.

If anyone can tell me what the best way to test a script is that would help me along too, I've been working with network manager dispatcher and it's be nice to test the script without having to reboot to do so

Offline

#2 2015-12-12 18:07:25

ukhippo
Member
From: Non-paged pool
Registered: 2014-02-21
Posts: 366

Re: bash scripting

Have you looked at the wiki page? In particular the “see also” section.

Offline

#3 2015-12-12 18:27:55

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: bash scripting

The tutorials listed on the wiki page with the exception of ABS (which is error prone) are the best guides.

The Bash Hackers Wiki also has a rated guide: http://wiki.bash-hackers.org/scripting/tutoriallist


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#4 2015-12-13 11:55:47

jbodhorn
Member
Registered: 2015-12-11
Posts: 130

Re: bash scripting

The Arch wiki is quite amazing, I had overlooked the bash section. Thank you both for your responses. Today I came across this website
http://www.grymoire.com/ which has borne shell and info on using a bunch of commands and cli programs, I even used httrack to download it for offline viewing, which I think I just might do with the Arch wiki also.

I've managed to break my wifi a couple times in the past few days and between searching the wiki and searching the forum I've gotten it fixed each time, but I'm sick of searching from my phone...

I totally forgot to submit this and have been downloading the Arch wiki, I think I meant to start the download and finish this post.... I must have messed something up cause httrack is downloading all sorts or stuff and I've almost reached 1gb of data already.... atm I'm a bit worried my 50gb Arch partition is gonna run out of room. I regret not making more room on my hard drive when I decided to try Arch, it's quickly becoming my favorite OS

Offline

#5 2015-12-13 16:07:49

ukhippo
Member
From: Non-paged pool
Registered: 2014-02-21
Posts: 366

Re: bash scripting

The wiki pages also include a discussion, source and historical versions of each page (check the tabs at the top of a wiki page to see what I mean). Unless you configured otherwise, httrack will download those as well.

Offline

#6 2015-12-14 21:57:08

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Offline

#7 2015-12-15 00:58:41

jbodhorn
Member
Registered: 2015-12-11
Posts: 130

Re: bash scripting

I'm impressed more each day, thank you for that link.

Arch, it's website, it's community, it's the best I've ever had. And to think, just a week ago my favorite OS was Fedora!? I'm really considering wiping my hard drive so I can get rid of Fedora(or at least give it a small partition instead of most of my drive) and install arch properly, with multiple partitions, and room, lots of room... I had a 50gb partition with Ubuntu installed as a back up OS in case I broke Fedora before I put arch on.

I can honestly say i do't pan to log back into Fedora unless I break Arch. I've heard so many great things about Arch and used its wiki to solve lots of problems with other OS's, I figured it was about time to try it. My little Chromebook runs way better than when chrome OS was installed, Arch is significantly better than fedora was, no regrets at all!

Offline

#8 2015-12-15 06:23:32

severach
Member
Registered: 2015-05-23
Posts: 198

Re: bash scripting

If you don't break Arch, how are you going to learn how to fix it, and all other Linux systems?

The C++ ABI update left one of my computers booting to blinking cursor. Not so much as a peep from Syslinux. Most of the time was spent deciding which bootable flash drive I was going to use to fix it.

Someone else had Mint in a no boot situation after a failed upgrade. Solution: reinstallsheimers!

Prepare to be impressed all the way to the top until you realize the truth. There is no top.

Offline

#9 2015-12-15 15:27:37

jbodhorn
Member
Registered: 2015-12-11
Posts: 130

Re: bash scripting

severach wrote:

If you don't break Arch, how are you going to learn how to fix it, and all other Linux systems?

The C++ ABI update left one of my computers booting to blinking cursor. Not so much as a peep from Syslinux. Most of the time was spent deciding which bootable flash drive I was going to use to fix it.

Someone else had Mint in a no boot situation after a failed upgrade. Solution: reinstallsheimers!

Prepare to be impressed all the way to the top until you realize the truth. There is no top.

I've mostly used Ubuntu, Raspbian, and Fedora, but I've played around with a bunch of others and BTW, I'm very good at breaking things.... If nothing else the Arch wiki and forum has helped me figure out what to search for, if not give me a way to fix what was wrong. I think the hardest part of fixing a problem(reguardless of OS) is knowing what to search for if it's something you haven't seen before.

I could not get my wifi to connect with network manager after accidentally reinstalling some gnome packages, it took me many hours to figure out it was trying to connect with the not working wifi-menu profiles that I had told systemd to run as a service during the Arch install. That still has me wondering why I was able to get network manager to connect my wifi before I reinstalled those packages... In the end it was two simple commands to stop and disable the profiles. If I hadn't been able to find someone having an issue with their wifi connecting and someone telling them how to check if the service was running I'd probably have ended up reinstalling Arch...

I think learning bash is something I should have done from the beginning of my linux use, it probably would have made life much easier. The simple fact that there is a GUI for most things made it not necessary to learn the command line right away. I don't know that I would have kept using Linux if I was forced to first learn the command line just to install an OS, Micro$oft had me spoiled and dumbed down. The bash section of the Arch wiki itself wasn't of too much help to me, but it has a bunch of links that sure are. I've been going through thishttp://tldp.org/LDP/abs/html/index.html and it's quite informative and easy to follow along. I like how at the end of each chapter it gives you a few ideas for scripts to write to practice what was learned that chapter. This post: https://bbs.archlinux.org/viewtopic.php?id=56646 is awesome, it's very cool to see what people made.

Someday I will be a command line/bash ninja, that bash scripting guide has already helped me write a few simple scripts to make my life easier. I've been(seriously as main OS) using some form of Linux for a little over two years now, I started with the Chromebook I'm still using today and got a Raspberry Pi shortly after. It wasn't until yesterday that I learned you can write a script, drop it into the proper folder and execute it by just typing its name from any folder in terminal. There have been a bunch of times where I wondered how it was an advantage to write and use scripts when there was a GUI solution to what they did. I found them to be a pain in the butt, having to go to the folder the script was located before executing it, not to mention getting them to work for me...

It was more time consuming for me to use a script than clicking in a few places, but now I can mount and un-mount all of my samba shares just by typing cifsup/cifsdown, and suddenly things make sense. Now I'm looking forward to writing more complex scripts in the future, and I have a book from the library called python for kids, learning python is something I've been wanting to tackle since getting a Raspberry Pi kit for Christmas two years ago. A couple weeks ago I finally used the breadboard that came with the kit for the first time and got an led to turn on and off, I've never been so proud of such a simple task!

Offline

Board footer

Powered by FluxBB