You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Heard about this project on Linux Unplugged, wanted to give it a try. I use zsh, and the install.sh butchered my prompt by trying to source ~/.bashrc into a zsh session. I re-wrote the script to detect if the user is running bash or zsh and change the output file accordingly, but this install.sh doesn't seem to be in the git tree anywhere so I wasn't able to make a pull request.
Also, before editing a user's bashrc/zshrc we should give them the opportunity to do it manually if they wish. I know a lot of people (myself included) have a lot of custom stuff in their shell startup and the thought of an automated script messing with it always makes me nervous. (Yes, this script just appends lines to the end, but still.)
Here's what I wrote, it could definitely be improved upon but I wanted to at least pass on the two minutes of work I did!
#!/bin/sh
SCRIPT_DIRECTORY=$(dirname "$(readlink -f "$0")")if [ "$SHELL"="/bin/bash" ];then
RCFILE=~/.bashrc
elif [ "$SHELL"="/usr/bin/zsh" ];then
RCFILE=~/.zshrc
else
RCFILE=~/.profile # if we can't detect the shell, use a sane default that all modern shells look atfiecho"This installation script will try and set things up automatically."echo"In order to do so, some environment variables will be appended to $RCFILE"echo"If you want to do this manually, hit CTRL-C now and examine this script."echo"Otherwise, just hit enter and we'll do the work for you!"readwait# just wait for the user to readecho"">>$RCFILE# in case the rcfile doesn't end with a newline, forcefully add oneecho"# mp4grep environment variables -------">>$RCFILEecho"export MP4GREP_CACHE='$SCRIPT_DIRECTORY/.mp4grep_cache'">>$RCFILEecho"export MP4GREP_MODEL='$SCRIPT_DIRECTORY/model'">>$RCFILEecho -n 'export PATH="$PATH:'>>$RCFILEecho"$SCRIPT_DIRECTORY/bin\"">>$RCFILEecho"# --------------------------------------">>$RCFILEecho"Completed environment setup for mp4grep: "echo"MP4GREP_CACHE=$SCRIPT_DIRECTORY/.mp4grep_cache"echo"MP4GREP_MODEL=$SCRIPT_DIRECTORY/model"echo -n 'PATH=$PATH:'echo"$SCRIPT_DIRECTORY/bin"echo""echo"Variables exported in $RCFILE"source$RCFILE
The text was updated successfully, but these errors were encountered:
Heard about this project on Linux Unplugged, wanted to give it a try. I use zsh, and the install.sh butchered my prompt by trying to source ~/.bashrc into a zsh session. I re-wrote the script to detect if the user is running bash or zsh and change the output file accordingly, but this install.sh doesn't seem to be in the git tree anywhere so I wasn't able to make a pull request.
Also, before editing a user's bashrc/zshrc we should give them the opportunity to do it manually if they wish. I know a lot of people (myself included) have a lot of custom stuff in their shell startup and the thought of an automated script messing with it always makes me nervous. (Yes, this script just appends lines to the end, but still.)
Here's what I wrote, it could definitely be improved upon but I wanted to at least pass on the two minutes of work I did!
The text was updated successfully, but these errors were encountered: