Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect output is broken #70

Open
capedra opened this issue Nov 15, 2021 · 3 comments
Open

Redirect output is broken #70

capedra opened this issue Nov 15, 2021 · 3 comments

Comments

@capedra
Copy link

capedra commented Nov 15, 2021

Since this option does not work for me, because it still prints several lines on my output, this is what I did for Cron to work fine running this Bash script:

#!/bin/sh
speedtest=$(/usr/local/bin/node /usr/local/lib/node_modules/fast-cli/cli.js --single-line -u | tail -n 1 | awk '{ print substr( $0, 17 ) }')
result=$(date +'%d/%m/%Y %T ')$(echo $speedtest)
echo $result >> speedtest.txt
@sindresorhus
Copy link
Owner

Can you show an example of where it prints more than a single line? If it does, it's a bug.

@capedra
Copy link
Author

capedra commented Nov 24, 2021

@sindresorhus
Hello Sindre. Sorry about my delay. The issue consists when you output the response of the command to some file. On the terminal you can see one line only, but when you redirect the output to the txt file, you can see several blank lines, white spaces, carriage returns and line breaks.
Anyway, I did this Bash script to include the current date/time and only the last line (the one that matters) of the fast-cli command, eliminating all these unnecessary characters.
I'm attaching the output file of the bash script above that I developed: speedtest.txt
Thank you very much and keep improving this project since it works a lot better than the speedtest-cli!!!

@sindresorhus
Copy link
Owner

Seems like we broke redirected output in 08b3cf7.

@sindresorhus sindresorhus changed the title Cron and --single-line Redirect output is broken May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants