LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Blogs > linux-related notes
User Name
Password

Notices


Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
  1. Old Comment
    Posted 05-29-2017 at 06:08 AM by Kefijoo Kefijoo is offline
  2. Old Comment
    Posted 04-27-2017 at 07:07 PM by astrogeek astrogeek is offline
  3. Old Comment

    Apparently [[ *"$a"* == $b ]] is DIFFERENT from [[ $b == *"$a"* ]]

    Quote:
    Originally Posted by astrogeek View Comment
    [...]

    By associativity, $b is evaluated first, it is "foo/bar/gee". Then the thing on the right *"foo/bar"* is evaluated and tested for equality with the thing on the left. "foo/bar" inside something else (i.e. with optional leading or trailing characters) is indeed equal to "foo/bar/gee".

    Hope this helps!

    It definitely does! It's a shame I can't upvote blog comments, apparently.
    Posted 04-27-2017 at 05:57 PM by the dsc the dsc is offline
  4. Old Comment

    Apparently [[ *"$a"* == $b ]] is DIFFERENT from [[ $b == *"$a"* ]]

    Actually, that is not odd at all, and yes they are two totally different tests.

    The result is due to ordinary associativity and precedence rules. (About fifth grade concepts ). The equality test is left associative - it evaluates the left side first, then compares the right side to what was on the left (it has to start somewhere!).

    The first test is actually "a equals b", not "b contains a" as your printed string says.

    This is because the equal test is left associative - the thing on the left is evaluated first, then the thing on the right is tested for equality to it.

    The thing on the left is *"$a"*, or $a within something else... but the something else here is null, so it is just "$a", or "foo/bar". Then the thing on the right $b is evaluated for equality with exactly that, "foo/bar", and "foo/bar/gee" is indeed not equal to that!

    The second test is different, "b equals (a with optional leading and trailing characters)".

    By associativity, $b is evaluated first, it is "foo/bar/gee". Then the thing on the right *"foo/bar"* is evaluated and tested for equality with the thing on the left. "foo/bar" inside something else (i.e. with optional leading or trailing characters) is indeed equal to "foo/bar/gee".

    Hope this helps!
    Posted 04-27-2017 at 05:54 PM by astrogeek astrogeek is offline
  5. Old Comment

    Apparently [[ *"$a"* == $b ]] is DIFFERENT from [[ $b == *"$a"* ]]

    Yikes. I feel your pain. I use bash every day but I just don't trust it to be consistent in its syntax. I think I understand something in bash and then ... it does something squirrely and unexpected.
    Posted 04-26-2017 at 05:32 PM by jr_bob_dobbs jr_bob_dobbs is offline
  6. Old Comment

    mimeopen: a nice tool to setup default applications

    xdg-open will ise the native desktop tools to open files if the desktop is detectable, eg exo-open when using xfce.
    Posted 11-20-2016 at 06:13 AM by Keith Hedger Keith Hedger is offline
  7. Old Comment

    mimeopen: a nice tool to setup default applications

    Thanks. I'll look into this, rather than xdg-open for my Openbox pipe menus. Maybe it will make sharing them easier. xdg-open works for me, never ran into any issue Keith has (I use Openbox, no DE) but then again I guess some application I have installed may have pulled in what makes it work.
    Posted 11-20-2016 at 03:54 AM by goumba goumba is offline
  8. Old Comment

    mimeopen: a nice tool to setup default applications

    I think that fairly recently I've had problems with file associations, but unfortunately I had forgotten about this tool then, and sorted it out in a much more annoying and clumsy manner, whatever it turned out to be.
    Posted 11-17-2016 at 03:55 PM by the dsc the dsc is offline
  9. Old Comment

    mimeopen: a nice tool to setup default applications

    mimetype and mimeopen work so much better than xdg-open, especially as i run a custom DE, xdg-* only really supports kde/gnome/xfce
    Posted 11-12-2016 at 09:09 AM by Keith Hedger Keith Hedger is offline
  10. Old Comment

    Poor, but acceptable, work-around to the lack of image previews for XCF and ORA (maybe other formats as well)

    Thanks. It's ImageMagick. I haven't tried GraphicsMagick that yet, but the problem with some non-GIMP XCF-to-something conversion methods is that they often won't deal correctly with transparencies, creating images with some 100% black rectangular areas, sometimes obscuring stuff that was supposed to be visible.
    Posted 09-27-2016 at 07:33 PM by the dsc the dsc is offline
    Updated 09-27-2016 at 08:16 PM by the dsc
  11. Old Comment

    Poor, but acceptable, work-around to the lack of image previews for XCF and ORA (maybe other formats as well)

    I see you're using convert for the ORA previews, so I guess you are using GraphicsMagick? At least on Sid, GM supports XCF.

    If so, give this one a shot:

    Code:
    convert -layers merge -quality 72 ${1} ${however_you_want_to_name_preview}
    would perhaps knock down your script to :

    Code:
    function make_thumbnail() {
        new_filename=${1/./_}_preview.png
        convert_flags="-layers merge -quality 72"
        case ${1##*.} in
            ora)
                # Check ORA version and proceed...?
                unzip -p ${1} mergedimage.png | convert png:- ${convert_flags} ${new_filename}
                ;;
            xcf)
                convert ${convert_flags} ${1} ${new_filename}
                ;;
        esac
    }
    Of course you don't need to make it a function, but doesn't hurt either if you want to add it to a larger library later on.
    Posted 09-27-2016 at 09:30 AM by goumba goumba is offline
    Updated 09-27-2016 at 09:44 AM by goumba
  12. Old Comment

    [MYSTERY SOLVED] What does "echo ???????????????" really do?

    It would probably have been more obvious if I hadn't had the impression that it was somehow echoing history entries, for some reason.
    Posted 04-28-2016 at 08:01 AM by the dsc the dsc is offline
  13. Old Comment

    [MYSTERY SOLVED] What does "echo ???????????????" really do?

    erm,
    I don't know why that didn't "click" earlier.

    Glad it worked out.
    Posted 04-21-2016 at 08:27 PM by Habitual Habitual is offline
  14. Old Comment

    [MYSTERY SOLVED] What does "echo ???????????????" really do?

    Code:
    18:07 dsc / $ \echo ????
    boot home proc root sbin
    (Didn't know this inverted dash shorthand for the non-aliased executable, cool)

    Just noticed something similar happens even with printf, with a less "parsed" output (no newlines, as usual), and somewhat different as well:

    Code:
    18:12 dsc / $ printf ????
    boot18:12 dsc / $ 
    18:12 dsc / $ \printf ????
    boot18:12 dsc / $ 
    18:12 dsc / $

    And also with plain bash (I guess):

    Code:
    18:43 dsc / $ bash --norc
    bash-4.3$ echo ????
    boot home proc root sbin
    bash-4.3$

    Eventually I'll boot on Debian to see if it does the same.

    Still on Ubuntu Wily, the mystery-folder/file through "?????" is also present in other commands, such as ls:

    Code:
    18:57 dsc / $ echo ???
    bin dev etc lib mnt opt run smb srv sys tmp usr var
    18:57 dsc / $ ls -1 ???
    bin:
    bash
    bunzip2
    bzcat
    
    [...]
    Posted 04-21-2016 at 04:07 PM by the dsc the dsc is offline
    Updated 04-21-2016 at 04:59 PM by the dsc
  15. Old Comment
    Posted 04-21-2016 at 06:09 AM by Habitual Habitual is offline
  16. Old Comment

    Opera Presto had the best GUI ever. Ever.

    Quote:
    It is still the open code Apple put out a long time ago. everyone just gives it a new name.
    Including Apple whom originally forked it from KDE's KHTML.


    I've been trying out the beta of Vivaldi and so far I like what I see.It's kind of what I was expecting from Opera when they first announced that they would be switching to webkit/blink, but unfortunately Opera decided to abandon their existing user base and go in a completely different direction with the new Opera Browser.

    I won't be returning to an Opera product: they've burnt that bridge. What I'm not sure of yet is whether I want to become invested in another proprietary solution (Vivaldi) given the lessons learnt from what happened with Opera/Presto and more recently Google's decision to kill off 32bit Chrome. "Once bitten..." and all that.
    Posted 03-24-2016 at 05:41 AM by GazL GazL is offline
  17. Old Comment

    Opera Presto had the best GUI ever. Ever.

    As a long time user of Opera presto I strayed after support was dropped. Today I downloaded the RPM and used slackware rpm2tgz and installed it.
    I am back as a opera user. I spend many hours building the chromium CEF3 webkit and looking at opera source code it seems these developers understand the needs of a browser. I love my speed dial. TY Opera for going open source all the way.
    Google forked webkit and called it something new. It is still the open code Apple put out a long time ago. everyone just gives it a new name.
    and started using the ppapi client. that is a wrapper.
    I think I will put a slackware build together when I have time.
    Posted 03-23-2016 at 04:08 PM by Drakeo Drakeo is offline
  18. Old Comment

    Parsing script arguments in bash, without getopt(s)

    While I agree with the above, I use something similar to #1 if for some reason I want to avoid getopts. Instead of testing the number of arguments remaining, I test the value of $1.

    I don't understand why the author of the second "solution" chose to shift within every condition. using shift at the end of the loop like the first to me would be less error prone (what if you add an argument, and forget to add shift?).
    Posted 03-20-2016 at 01:00 PM by goumba goumba is offline
  19. Old Comment

    Parsing script arguments in bash, without getopt(s)

    Using '=' to separate a short-option from its argument, or using a space to separate a long-option from its argument are non-standard and best avoided. I wouldn't recommend either of the above solutions in their current form.
    Posted 03-14-2016 at 08:08 AM by GazL GazL is offline
  20. Old Comment

    Fixing the annoying firefox' associations issue once and for all

    Linux has to makeup somehow, for not having viruses. "Linux doesn't have virus - it doesn't need them".
    Posted 01-10-2016 at 10:16 PM by the dsc the dsc is offline

  



All times are GMT -5. The time now is 02:28 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration