KittyKatt / screenFetch

Fetches system/theme information in terminal for Linux desktop screenshots.
GNU General Public License v3.0
3.83k stars 453 forks source link

readlink -f on BSD-like systems #573

Open andrewstein opened 6 years ago

andrewstein commented 6 years ago

On macos, I get the error

readlink: illegal option -- f
usage: readlink [-n] [file ...]

before the information printed by screenfetch....

$ screenfetch 
readlink: illegal option -- f
usage: readlink [-n] [file ...]

                 -/+:.          xxxx@YYYYYY
                :++++.          OS: 64bit Mac OS X 10.13.5 17F77
               /+++/.           Kernel: x86_64 Darwin 17.6.0
       .:-::- .+/:-``.::-       Uptime: 11d 16h 55m
    .:/++++++/::::/++++++/:`    Packages: 60
  .:///////////////////////:`   Shell: bash 3.2.57
  ////////////////////////`     Resolution: 2880x1800 1920x1080 3840x2160
 -+++++++++++++++++++++++`      DE: Aqua
 /++++++++++++++++++++++/       WM: Quartz Compositor
 /sssssssssssssssssssssss.      WM Theme: Blue
 :ssssssssssssssssssssssss-     CPU: Intel Core i7-7700HQ @ 2.80GHz
  osssssssssssssssssssssssso/`  GPU: Intel HD Graphics 630 / Radeon Pro 560 
  `syyyyyyyyyyyyyyyyyyyyyyyy+`  RAM: 8583MiB / 16384MiB
   `ossssssssssssssssssssss/   
     :ooooooooooooooooooo+.    
      `:+oo+/:-..-:/+o+/-      
andrewstein commented 6 years ago

More info:

$ which readlink
/usr/bin/readlink
$ man readlink

STAT(1)                   BSD General Commands Manual                  STAT(1)

NAME
     readlink, stat -- display file status

SYNOPSIS
     stat [-FLnq] [-f format | -l | -r | -s | -x] [-t timefmt] [file ...]
     readlink [-n] [file ...]

DESCRIPTION
...
     When invoked as readlink, only the target of the symbolic link is
     printed.  If the given argument is not a symbolic link, readlink will
     print nothing and exit with an error.
...
andrewstein commented 6 years ago

See also https://stackoverflow.com/questions/1055671/how-can-i-get-the-behavior-of-gnus-readlink-f-on-a-mac

andrewstein commented 6 years ago
$ screenfetch -V
screenFetch - Version 3.8.0
Created by and licensed to Brett Bohnenkamper <kittykatt@kittykatt.us>
OS X porting done almost solely by shrx (https://github.com/shrx) and John D. Duncan, III (https://github.com/JohnDDuncanIII).

This is free software; see the source for copying conditions.  There is NO warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
ningblue commented 5 years ago

Excuse me, has this problem been fixed?

muttmutt commented 5 years ago

You can fix it on your own for now by replacing "readlink" with "stat" in the script.

elif readlink -f "$SHELL" | grep -q "busybox"; then becomes elif stat -f "$SHELL" | grep -q "busybox"; then

darealshinji commented 5 years ago

@muttmutt Can you make a pull request with such a fix?

muttmutt commented 5 years ago

@darealshinji It's actually already in process. See #602 for details.

muttmutt commented 5 years ago

I suspect we'll see a 3.8.1 version with this (and other) fixes.