LQ Suggestions & FeedbackDo you have a suggestion for this site or an idea that will make the site better? This forum is for you.
PLEASE READ THIS FORUM - Information and status updates will also be posted here.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Good catch! Hmmm. I wonder if debian wants the () removed completely... I will spin up a debian instance to test on as well so I can cover Centos/Debian variants at least.
He was running it by invoking it
Code:
sh ldebug.sh
If you run it, invoking as bash, as you had intended, the script completes fine. There are no errors about parens.
I made the script executable (chmod +x) on my Debian machine and it ran correctly. I'll look forward to reading up tomorrow about why that was. In any event, it might be wise to anticipate that others might also be unaware of this, especially the target audience (as we would say in the training biz) for this script.
This is something I've not run into before. Thanks to both of you.
Afterthought:
So using sh to run a script specifically invokes the shell shell, as opposed to any other shell?
HA. Not at all. Just figured that page could explain it better than I could.
In short, if you invoke bash using 'sh', either by
Code:
sh script
or
Code:
#!/bin/sh
bash will run in a stricter POSIX compliant mode, as the original bourne shell would have. So a lot of stuff we expect to work, will not, because they are actually bash specific.
Invoking bash as itself
Code:
bash script
or
Code:
#!/bin/bash
will allow a script to use those bash specific builtins and syntax.
There seem to be a few things (myself included) do when we write shell scripts that are bash specific, but don't realize it until cases like this. Some are obvious, some documented better than others.
Shouldn't we 'represent' LQ with lqdebug and not ldebug?
output to a pastebin-like URI?
Seems the poor dears can't find the code boxen to save their lives. Bless their hearts.
More than enough diverse hosts to run any script against.
Subscribed with interest...
Good points. I would not name it lqdebug without the blessing of Jeremy. So to keep it general and without official ties to LQ I think it should stay 'ldebug'.. That was my thought.
Changed the pastebin line to be more general.
Would love to have you collaborate. Just fork and pull request any changes/additions you would like. Thanks for your input.
One thing I was thinking of was allowing auto-pasting to the related LQ thread number as a 'ldebug output reply' or something. I could do that real simple like if there were an API, but my username/password + curl request is a bit rusty to do so. Seem like something you could shine light on?
Last edited by szboardstretcher; 12-29-2016 at 09:47 AM.
It's just a pet project. Everything has been done before. Bashtool, ohai etc... But i'm trying to keep ldebug wayyyyyyyyyyyyyyy smaller than 15000 lines and easy to read and understand.
Most likely it will disappear into obscurity or never be used by anyone but myself,.. but until then it's hopefully a nice way to collaborate and talk with other interested LQ members. It's nice to be a part of making something useful. And it's in bash - so no one has to take hours out of their day to debug and contribute. Someone can just add a good command and call it a day. Or make a suggestion. That sort of thing.
Last edited by szboardstretcher; 12-29-2016 at 10:16 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.