Welcome to DU! The truly grassroots left-of-center political community where regular people, not algorithms, drive the discussions and set the standards. Join the community: Create a free account Support DU (and get rid of ads!): Become a Star Member Latest Breaking News Editorials & Other Articles General Discussion The DU Lounge All Forums Issue Forums Culture Forums Alliance Forums Region Forums Support Forums Help & Search

eppur_se_muova

(37,585 posts)
Thu Mar 29, 2018, 01:40 PM Mar 2018

"Writing a shell script is like riding a bike."

Writing a shell script is like riding a bike. You fall off and scrape your knees a lot at first. With a bit more experience, you become comfortable riding them around town, but also quickly discover why most people drive cars for longer trips.

https://developer.apple.com/library/content/documentation/OpenSource/Conceptual/ShellScripting/shell_scripts/shell_scripts.html#//apple_ref/doc/uid/TP40004268-CH237-SW3


5 replies = new reply since forum marked as read
Highlight: NoneDon't highlight anything 5 newestHighlight 5 most recent replies
"Writing a shell script is like riding a bike." (Original Post) eppur_se_muova Mar 2018 OP
You have to pedal like hell to get up a hill? Fullduplexxx Mar 2018 #1
shell scripts are the APL of scripting languages. lapfog_1 Mar 2018 #2
exceptions Hermit-The-Prog Mar 2018 #3
deep, dark secrets of bash Hermit-The-Prog Mar 2018 #4
"MS-DOS is sniffing glue..." hunter Apr 2018 #5

lapfog_1

(30,225 posts)
2. shell scripts are the APL of scripting languages.
Thu Mar 29, 2018, 02:07 PM
Mar 2018

good for a one time action, not generally maintainable or provable ( only because they are generally written without much thought as to error recovery or unexpected input handling )

Speaking as someone who has written code and scripts for a living for over 35 years now.

I rarely see well-documented shell scripts.

Hermit-The-Prog

(36,603 posts)
3. exceptions
Thu Mar 29, 2018, 03:18 PM
Mar 2018

There are exceptions to that. I wrote one to back up files to CDs, 'way back before DVDs. It contains full documentation -- name, license, where to get it, outline (I., II., III., etc., of process, variables, user prompts, checks, functions), and finishes with "# an added attraction for those who are not easily offended by bad ascii art" -- an ASCII flowchart.

I used that thing even after DVDs came along because the target maximum "iso" image was set by user input. Of course, hard drives became a cheaper backup media very near the same time as DVDs appeared.

Then there is the 44K bash script I wrote which is a prime example of your rule. Its purpose was to tie a conglomerated mess of a business data system together. They had a dos-based data entry system whose output had to be transmogrified to go into a postgresql database on a GNU/Linux system to produce monthly bills and reports. It worked for 6 years and was chock full of 'corner cases'. There are bits and pieces of it I might be able to explain now. It became a sort of Jenga -- edit only certain parts known not to break.

hunter

(39,011 posts)
5. "MS-DOS is sniffing glue..."
Mon Apr 2, 2018, 02:14 PM
Apr 2018


There's a parallel universe where Bill Gates and Steve Jobs graduated from Berkeley.

It's probably a better place.
Latest Discussions»Help & Search»Computer Help and Support»"Writing a shell script i...