Skip to content

Commit

Permalink
Fix configure_bashrc_exec_tmux missing parentheses
Browse files Browse the repository at this point in the history
  • Loading branch information
BenoitGui committed Jan 16, 2024
1 parent 80b5408 commit 023fabe
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
# complexity = low
# disruption = low

if ! grep -x ' case "$name" in sshd|login) exec tmux ;; esac' /etc/bashrc; then
if ! grep -x ' case "$name" in (sshd|login) exec tmux ;; esac' /etc/bashrc; then
cat >> /etc/profile.d/tmux.sh <<'EOF'
if [ "$PS1" ]; then
parent=$(ps -o ppid= -p $$)
name=$(ps -o comm= -p $parent)
case "$name" in sshd|login) exec tmux ;; esac
case "$name" in (sshd|login) exec tmux ;; esac
fi
EOF
chmod 0644 /etc/profile.d/tmux.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<ind:textfilecontent54_object id="obj_configure_bashrc_exec_tmux" version="1">
<ind:behaviors singleline="true" multiline="false" />
<ind:filepath operation="pattern match">^/etc/bashrc$|^/etc/profile\.d/.*$</ind:filepath>
<ind:pattern operation="pattern match">if \[ "\$PS1" \]; then\n\s+parent=\$\(ps -o ppid= -p \$\$\)\n\s+name=\$\(ps -o comm= -p \$parent\)\n\s+case "\$name" in sshd\|login\) exec tmux ;; esac\nfi</ind:pattern>
<ind:pattern operation="pattern match">if \[ "\$PS1" \]; then\n\s+parent=\$\(ps -o ppid= -p \$\$\)\n\s+name=\$\(ps -o comm= -p \$parent\)\n\s+case "\$name" in \(?sshd\|login\) exec tmux ;; esac\nfi</ind:pattern>
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance>
</ind:textfilecontent54_object>
</def-group>
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fixtext: |-
if [ "$PS1" ]; then
parent=$(ps -o ppid= -p $$)
name=$(ps -o comm= -p $parent)
case "$name" in sshd|login) exec tmux ;; esac
case "$name" in (sshd|login) exec tmux ;; esac
fi
Then, ensure a correct mode of /etc/profile.d/tmux.sh using this command:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ cat >> /etc/bashrc <<'EOF'
if [ "$PS1" ]; then
parent=$(ps -o ppid= -p $$)
name=$(ps -o comm= -p $parent)
case "$name" in sshd|login) exec tmux ;; esac
case "$name" in (sshd|login) exec tmux ;; esac
fi
EOF

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ cat >> /etc/profile.d/00-complianceascode.conf <<'EOF'
if [ "$PS1" ]; then
parent=$(ps -o ppid= -p $$)
name=$(ps -o comm= -p $parent)
case "$name" in sshd|login) exec tmux ;; esac
case "$name" in (sshd|login) exec tmux ;; esac
fi
EOF

Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ cat >> /etc/profile.d/00-complianceascode.conf <<'EOF'
if [ "$PS1" ]; then
parent=$(ps -o ppid= -p $$)
name=$(ps -o comm= -p $parent)
case "$name" in sshd|login) exec tmux ;; esac
case "$name" in (sshd|login) exec tmux ;; esac
fi
EOF

cat >> /etc/bashrc <<'EOF'
if [ "$PS1" ]; then
parent=$(ps -o ppid= -p $$)
name=$(ps -o comm= -p $parent)
case "$name" in sshd|login) exec tmux ;; esac
case "$name" in (sshd|login) exec tmux ;; esac
fi
EOF

0 comments on commit 023fabe

Please sign in to comment.