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

Fix install.sh output #842

Merged
merged 1 commit into from
Aug 25, 2023
Merged

Fix install.sh output #842

merged 1 commit into from
Aug 25, 2023

Commits on Aug 24, 2023

  1. Fix install.sh output

    The behavior of the `echo` command and its handling of escape sequences, such as `\n`, can exhibit variability across different implementations of shells and utilities. This variability was evident during my experience while executing the `install.sh` script on a newly installed Fedora system:
    
    ```bash
    [xander@fedora ~]$ curl https://rtx.pub/install.sh | sh
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100  4302  100  4302    0     0  78350      0 --:--:-- --:--:-- --:--:-- 79666
    rtx: installing rtx...
    rtx: installed successfully to /home/xander/.local/share/rtx/bin/rtx
    rtx: run the following to activate rtx in your shell:
    echo "eval \"\$(/home/xander/.local/share/rtx/bin/rtx activate bash)\"" >> ~/.bashrc\n # <--newline
    rtx: this must be run in order to use rtx in the terminal
    rtx: run `rtx doctor` to verify this is setup correctly
    ```
    
    Furthermore, a direct copy-paste of the command could potentially lead to unintended consequences. For instance, when executed in a bash shell, the command may inadvertently remove the trailing backslash:
    
    ```bash
    [xander@fedora ~]$ echo "eval \"\$(/home/xander/.local/share/rtx/bin/rtx activate bash)\"" >> ~/.bashrc\n
    [xander@fedora ~]$ cat .bashrcn # note the `n` at the end
    eval "$(/home/xander/.local/share/rtx/bin/rtx activate bash)"
    [xander@fedora ~]
    ```
    
    Podman testing showed consistent `echo` behavior with bash across distributions, except for Debian and Ubuntu (using dash) which interpret escape sequences by default. Thus, replacing the newlines with empty `info` calls appears to be the most portable solution.
    xanderificnl authored Aug 24, 2023
    Configuration menu
    Copy the full SHA
    e450166 View commit details
    Browse the repository at this point in the history