UCL-ARC / swc-shell-split-window

Script to split the shell using tmux
MIT License
36 stars 16 forks source link

Mac doesn't show the history on the top panel #2

Open benlaken opened 8 years ago

benlaken commented 8 years ago

Seems that on mac the script doesn't write to the /tmp/log-file. Problem may be on line 48 "HISTFILE='${LOG_FILE}' HISTCONTROL=ignorespace PROMPT_COMMAND='history -a' bash --norc; kill '${LOG_PID}'" with the -a flag, which is different for mac. When I remove the flag the history is writing to the file. However the history then appears in the SHELL_PANE not the LOG_PANE.

omsai commented 8 years ago

What version of bash are you using?

The log pane only seems to function with bash 4.2.0 and later (also does not work with bash 3.2.57). In earlier versions, the history is held up until you quit from tmux, and then all the history is written to the file. You can verify this by running tail -f /tmp/log-file (or where ever you are saving your log, if you're setting the LOG_FILE environmental variable) and then seeing the history is only written as soon as you exit tmux. I ran into this issue with RHEL 6.7 on our cluster and ended up just using the bash 4.3 module from spack:

spack install bash
spack load bash
bash --version
path/to/swc-shell-split-window.sh

Maybe README.md can be updated to mention >= bash-4.2 as a dependency in addition to tmux.

djhoese commented 6 years ago

FYI I ran in to this issue, but was able to install a newer bash with macports (or homebrew) and now things seem to be working.

olexandr-konovalov commented 3 years ago

Encountered this right now and fixed with installing new bash with homebrew - thanks for reporting this and for the tips how to fix!

mattagape commented 3 years ago

One point: on my MacBook Pro I had a job getting it to work at first, as my default shell was zsh, and I had to get it to change to the version of bash installed by homebrew. I also had an issue with the fact that I had put a comment in between two lines of the same command in the shell script, and the script didn't like it.

i.e. do this:

 command \
    argument \
    `# comment` \
    other_argument \
    `# other comment`

but not this:

 command \
    argument \
    # comment \
    other_argument \
    # other comment

That is, any comments you put in the middle of a multi-line shell script command should have a backtick at the start and finish of the line (the backtick is the syntax for command substitution - kudos to @giordano for telling me this!)

liz-is commented 2 months ago

I'm also having the issue that the history is not shown in the top panel, on my mac.

olexandr-konovalov commented 2 months ago

@liz-is I used it in teaching in May on my mac, but in default shell (zsh). Does it work on your machine this way?