![]() |
|
I have a poor understanding of Batch/Bash scripting... - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Coding (https://sinister.ly/Forum-Coding) +--- Forum: Coding (https://sinister.ly/Forum-Coding--71) +--- Thread: I have a poor understanding of Batch/Bash scripting... (/Thread-I-have-a-poor-understanding-of-Batch-Bash-scripting) |
I have a poor understanding of Batch/Bash scripting... - xevenofhearts - 01-20-2013 Recently I've been in a... programming-y mood, even though I suck at it. I'm learning Objective-C, and in the book I'm reading about Obj.-C, it mentioned a scripting language for automation of your systems... Well considering that Apple's (Well, NeXT's...) programming environment is very well tied together, I decided I'd learn a bit of AppleScript, I did, but very basic stuff. Nothing really interesting, other than maybe a script that opens every App on someone's Mac I moved to Batch... but this presented a problem. Batch looks awesome... but I don't have Windows. I think it would be inconvenient to attempt to learn Batch on a Mac where it has no use xD Again, by reading tutorials, even some I found here on HC, I learned how to make loops, variables, and do various things with Batch, and I'd send these out to people I knew via Skype to test them, because I couldn't of course... xD Now, I'm here at Bash (or Bourne? I've seen Bourne mentioned I believe on somethin'-parker.org.), but I'm kind of confused. See, I really just want a scripting language that can perform all of my Terminal commands in order, but I don't really get it and I feel like a n00b. This is what I can do with Bash, right? Or is it a different syntax? I'm not sure, I kind of just got confused as to what Bash does/can do...\\\ Edit: I went ahead and went to /bin, and I see (on OS X) a bunch of files that I believe are exec's... One says sh, and one says bash. As I'm seeing in the Steve Parker tutorial, I think it's using SH, as I infer from this line of code : $ echo '#!/bin/sh' > my-script.sh All I know is that sh is in the bin folder, and it's mentioned in that line. Again, extremely poor understanding of it all, all help is appreciated. I have a poor understanding of Batch/Bash scripting... - xevenofhearts - 01-20-2013 Recently I've been in a... programming-y mood, even though I suck at it. I'm learning Objective-C, and in the book I'm reading about Obj.-C, it mentioned a scripting language for automation of your systems... Well considering that Apple's (Well, NeXT's...) programming environment is very well tied together, I decided I'd learn a bit of AppleScript, I did, but very basic stuff. Nothing really interesting, other than maybe a script that opens every App on someone's Mac I moved to Batch... but this presented a problem. Batch looks awesome... but I don't have Windows. I think it would be inconvenient to attempt to learn Batch on a Mac where it has no use xD Again, by reading tutorials, even some I found here on HC, I learned how to make loops, variables, and do various things with Batch, and I'd send these out to people I knew via Skype to test them, because I couldn't of course... xD Now, I'm here at Bash (or Bourne? I've seen Bourne mentioned I believe on somethin'-parker.org.), but I'm kind of confused. See, I really just want a scripting language that can perform all of my Terminal commands in order, but I don't really get it and I feel like a n00b. This is what I can do with Bash, right? Or is it a different syntax? I'm not sure, I kind of just got confused as to what Bash does/can do...\\\ Edit: I went ahead and went to /bin, and I see (on OS X) a bunch of files that I believe are exec's... One says sh, and one says bash. As I'm seeing in the Steve Parker tutorial, I think it's using SH, as I infer from this line of code : $ echo '#!/bin/sh' > my-script.sh All I know is that sh is in the bin folder, and it's mentioned in that line. Again, extremely poor understanding of it all, all help is appreciated. I have a poor understanding of Batch/Bash scripting... - xevenofhearts - 01-20-2013 Recently I've been in a... programming-y mood, even though I suck at it. I'm learning Objective-C, and in the book I'm reading about Obj.-C, it mentioned a scripting language for automation of your systems... Well considering that Apple's (Well, NeXT's...) programming environment is very well tied together, I decided I'd learn a bit of AppleScript, I did, but very basic stuff. Nothing really interesting, other than maybe a script that opens every App on someone's Mac I moved to Batch... but this presented a problem. Batch looks awesome... but I don't have Windows. I think it would be inconvenient to attempt to learn Batch on a Mac where it has no use xD Again, by reading tutorials, even some I found here on HC, I learned how to make loops, variables, and do various things with Batch, and I'd send these out to people I knew via Skype to test them, because I couldn't of course... xD Now, I'm here at Bash (or Bourne? I've seen Bourne mentioned I believe on somethin'-parker.org.), but I'm kind of confused. See, I really just want a scripting language that can perform all of my Terminal commands in order, but I don't really get it and I feel like a n00b. This is what I can do with Bash, right? Or is it a different syntax? I'm not sure, I kind of just got confused as to what Bash does/can do...\\\ Edit: I went ahead and went to /bin, and I see (on OS X) a bunch of files that I believe are exec's... One says sh, and one says bash. As I'm seeing in the Steve Parker tutorial, I think it's using SH, as I infer from this line of code : $ echo '#!/bin/sh' > my-script.sh All I know is that sh is in the bin folder, and it's mentioned in that line. Again, extremely poor understanding of it all, all help is appreciated. RE: I have a poor understanding of Batch/Bash scripting... - Deque - 01-20-2013 I am not sure, what you want to do now. Learn Bash? Here is a list of tutorials with review and rating: http://wiki.bash-hackers.org/scripting/tutoriallist There are also some programming languages designed for simple scripting tasks. I.e. Perl. If you don't like Bash, you might have a look into that. Here is a good Perl e-book: http://www.perl.org/books/beginning-perl/ If you still like to learn Batch, use a Virtual Machine with Windows on it. However Powershell is newer and is up to displace good old Batch. So you also might consider using that (but only if you want to temper with Windows, on OS X it doesn't make sense) RE: I have a poor understanding of Batch/Bash scripting... - xevenofhearts - 01-20-2013 (01-20-2013, 08:44 AM)Deque Wrote: I am not sure, what you want to do now. Learn Bash? I want to learn Bash, but seeing both sh and bash is confusing. I would think that it's perfectly fine to use sh, because all systems running with Unix should include bash & sh. RE: I have a poor understanding of Batch/Bash scripting... - phantasm8 - 10-31-2013 I use linux so my batch scripting specific tips will need to be tweaked for a mac... Anyway, I would recommend learning a concept then applying it. In BASH one of the first things I learned was how to output text using echo. I began to mess around and created scripts to print out video game characters in ASCII just for fun. I even tried to replicate the ASCII Star Wars and create a version of the Clone Wars (I failed miserably at this project BTW as it was a bit too big and I didnt have much time). I invite you to try something like this. Then when you get used to the process of generating shell scripts (even if they are simple and "useless") then you can increase complexity by opening files, creating exit codes, control structures, ect. Shell scripting is a powerful thing. Good luck with it. RE: I have a poor understanding of Batch/Bash scripting... - phantasm8 - 10-31-2013 I use linux so my batch scripting specific tips will need to be tweaked for a mac... Anyway, I would recommend learning a concept then applying it. In BASH one of the first things I learned was how to output text using echo. I began to mess around and created scripts to print out video game characters in ASCII just for fun. I even tried to replicate the ASCII Star Wars and create a version of the Clone Wars (I failed miserably at this project BTW as it was a bit too big and I didnt have much time). I invite you to try something like this. Then when you get used to the process of generating shell scripts (even if they are simple and "useless") then you can increase complexity by opening files, creating exit codes, control structures, ect. Shell scripting is a powerful thing. Good luck with it. RE: I have a poor understanding of Batch/Bash scripting... - The Real Slim Shady - 10-31-2013 Please dont dig up old posts. RE: I have a poor understanding of Batch/Bash scripting... - The Real Slim Shady - 10-31-2013 Please dont dig up old posts. |