hr icon indicating copy to clipboard operation
hr copied to clipboard

make script posix compliant

Open txgk opened this issue 2 years ago • 4 comments

This makes hr work in the busybox environment in my Alpine Linux container.

txgk avatar May 25 '22 13:05 txgk

Hey @txgk, I appreciate the PR, I think I'd rather keep hr as a bash script to make it easier to work with, but I was testing your changes and it doesn't seem to work in Alpine still, here's the steps I used.

With this Dockerfile:

FROM alpine

RUN apk update && apk add gcc make
COPY . /tmp

WORKDIR /tmp

RUN make install

Then running hr inside the container, I'm getting "tput: not found" is tput perhaps not part of ash? In which case, hr as it is would need a lot more work to make it work with ash.

Let me know if I am making any mistake in my testing.

LuRsT avatar Nov 30 '22 16:11 LuRsT

Hello!

I think I'd rather keep hr as a bash script to make it easier to work

That's fine, no problem.

Then running hr inside the container, I'm getting "tput: not found" is tput perhaps not part of ash?

The thing is that tput is not a part of bash either. In Linux distributions this utility is provided by ncurses usually.

hr as it is would need a lot more work to make it work with ash.

I don't think so. I'd say bash variant and POSIX variant aren't that different, it's just that you get portability with latter.

txgk avatar Nov 30 '22 19:11 txgk

Thanks for the reply @txgk!

The thing is that tput is not a part of bash either. In Linux distributions this utility is provided by ncurses usually.

Oh right, I wasn't aware, so then my test didn't work because the docker container did not have ncurses installed, I forgot/didn't realise that hr actually had that dependency, I'm going to take a second look at these changes then :+1:

LuRsT avatar Dec 05 '22 08:12 LuRsT

Take your time :D

txgk avatar Dec 05 '22 20:12 txgk