我最近问这个问题。我永远不会使用第一种方法。
gnome-terminal -e tmux ./
如果我把它放在.zshrc
or .bashrc
(两个外壳,同样的问题)中。如果我使用它,终端将永远打开新终端,无限循环。
我向用户询问了此事,他说它可以在他的计算机上运行,所以我接受了他的回答,他试图提供帮助,赏金即将到期,但问题仍然存在。
如果我发出该命令,它会很好地工作,但当它.zshrc
或.bashrc
.用户认为我.zshrc
的错误,但事实并非如此,否则我在采购时就会看到错误。无论如何,它在这里
ZSH_THEME="robbyrussell"
plugins=(git)
source $ZSH/oh-my-zsh.sh
alias ll='ls -l'
alias rm='rm -i'
alias ..="cd .."
alias ...="cd ../.."
alias ....="cd ../../.."
alias .....="cd ../../../.."
alias ......="cd ../../../../.."
alias githd='git reset --hard HEAD'
alias bre='gedit ~/.zshrc'
alias brs='source ~/.zshrc'
alias wl='sudo modprobe -r wl'
alias clam='sudo clamscan -r -i / > ~/clamav/clamav.log'
alias xa='sudo /opt/lampp/manager-linux-x64.run'
alias net='sudo nethogs'
alias android='sudo sh /opt/android-studio/bin/studio.sh'
alias rmgit='sudo rm -rf .git'
# Functions
function conv () { if ffmpeg -i $1 -codec copy $2;
then gvfs-trash $1 && cd ..;
fi }
function rt() { gvfs-trash $@; }
function mkcd {
last=$(eval "echo \$$#")
if [ ! -n "$last" ]; then
echo "Enter a directory name"
elif [ -d $last ]; then
echo "\`$last' already exists"
else
mkdir $@ && cd $last
fi
}
function j { java -jar $1; }
cmd() { curl "http://www.commandlinefu.com/commands/matching/$(echo "$@" \
| sed 's/ /-/g')/$(echo -n $@ | base64)/plaintext" ;}
calc() {
if which python2 &>/dev/null; then
python2 -ic "from __future__ import division; from math import *; from random import *"
elif which python3 &>/dev/null; then
python3 -ic "from math import *; import cmath"
elif which bc &>/dev/null; then
bc -q -l
else
echo "Requires python2, python3 or bc for calculator features"
fi
}
myip() {
echo "--------------- Network Information ---------------"
echo "router ip:" $(netstat -rn | awk 'FNR == 3 {print $2}')
# newer system like archlinux
ip addr | awk '/global/ {print $1,$2}' | cut -d\/ -f1
ip addr | awk '/global/ {print $3,$4}'
ip addr | awk '/ether/ {print $1,$2}'
ip addr | awk '/scope link/ {print $1,$2}' | cut -d\/ -f1
# older system like debian
ifconfig | awk '/inet addr/ {print $1,$2}' | awk -F: '{print $1,$2}'
ifconfig | awk '/Bcast/ {print $3}' | awk -F: '{print $1,$2}'
ifconfig | awk '/inet addr/ {print $4}' | awk -F: '{print $1,$2}'
ifconfig | awk '/HWaddr/ {print $4,$5}'
ifconfig | awk '/Scope:Link/ {print $1,$3}' | cut -d\/ -f1
# echo External IP $(curl -s http://checkip.dyndns.org/ | grep -o "[[:digit:].]\+")
# echo External IP: $(curl -s http://ipaddr.io/)
# echo External IP: $(curl -s https://icanhazip.com/)
# echo External IP: $(curl -s https://ifconfig.co/)
# echo External IP: $(curl -s http://pasteip.me/api/cli/ && echo)
echo external ip: $(curl -s http://ipecho.net/plain)
echo "---------------------------------------------------"
}
down4me() { curl -s "http://www.downforeveryoneorjustme.com/$1" | sed '/just you/!d;s/<[^>]*>//g';}
# Needed for virtualenvwrapper
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python2.7
export VIRTUALENVWRAPPER_PYTHON
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/Documents/Projects/Python
source /usr/bin/virtualenvwrapper.sh
.tmux.conf
assume-paste-time 1
base-index 0
bell-action any
bell-on-alert off
default-command ""
default-shell "/bin/zsh"
destroy-unattached off
detach-on-destroy on
display-panes-active-colour red
display-panes-colour blue
display-panes-time 1000
display-time 750
history-limit 2000
key-table "root"
lock-after-time 0
lock-command "lock -np"
message-command-style fg=yellow,bg=black
message-style fg=black,bg=yellow
mouse off
prefix C-b
prefix2 None
renumber-windows off
repeat-time 500
set-remain-on-exit off
set-titles off
set-titles-string "#S:#I:#W - "#T" #{session_alerts}"
status on
status-interval 15
status-justify left
status-keys emacs
status-left "[#S] "
status-left-length 10
status-left-style default
status-position bottom
status-right " "#{=21:pane_title}" %H:%M %d-%b-%y"
status-right-length 40
status-right-style default
status-style fg=black,bg=green
update-environment "DISPLAY SSH_ASKPASS SSH_AUTH_SOCK SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
visual-activity off
visual-bell off
visual-silence off
word-separators " -_@"
例如,从终端运行HOME=/home/user/Documents gnome-terminal -e tmux ./
是行不通的,它会打开 tmux 但不在Documents
文件夹中,而是在~/