How can start multiple tmux autoscript?
Clash Royale CLAN TAG#URR8PPP
This is in my TmuxHome.sh Script with I can start One Only Tmux Session:
# tmux Start Script Need To Work!!
if which tmux >/dev/null 2>&1; then
#if not inside a tmux session, and if no session is started, start a new session
test -z "$TMUX" && (tmux attach || tmux new-session)
fi
okay now i want to example TmuxHome.sh use default .tmux.conf and TmuxWork.sh use tmux-work.conf both enable and run separate sessions. how to go about doing this without problems?
Maybe Next TmuxTty.sh or TmuxDev.sh etc...
fine on arch wiki site:
https://wiki.archlinux.org/index.php/Tmux
it differences now then what it was before
tmux session
add a comment |
This is in my TmuxHome.sh Script with I can start One Only Tmux Session:
# tmux Start Script Need To Work!!
if which tmux >/dev/null 2>&1; then
#if not inside a tmux session, and if no session is started, start a new session
test -z "$TMUX" && (tmux attach || tmux new-session)
fi
okay now i want to example TmuxHome.sh use default .tmux.conf and TmuxWork.sh use tmux-work.conf both enable and run separate sessions. how to go about doing this without problems?
Maybe Next TmuxTty.sh or TmuxDev.sh etc...
fine on arch wiki site:
https://wiki.archlinux.org/index.php/Tmux
it differences now then what it was before
tmux session
add a comment |
This is in my TmuxHome.sh Script with I can start One Only Tmux Session:
# tmux Start Script Need To Work!!
if which tmux >/dev/null 2>&1; then
#if not inside a tmux session, and if no session is started, start a new session
test -z "$TMUX" && (tmux attach || tmux new-session)
fi
okay now i want to example TmuxHome.sh use default .tmux.conf and TmuxWork.sh use tmux-work.conf both enable and run separate sessions. how to go about doing this without problems?
Maybe Next TmuxTty.sh or TmuxDev.sh etc...
fine on arch wiki site:
https://wiki.archlinux.org/index.php/Tmux
it differences now then what it was before
tmux session
This is in my TmuxHome.sh Script with I can start One Only Tmux Session:
# tmux Start Script Need To Work!!
if which tmux >/dev/null 2>&1; then
#if not inside a tmux session, and if no session is started, start a new session
test -z "$TMUX" && (tmux attach || tmux new-session)
fi
okay now i want to example TmuxHome.sh use default .tmux.conf and TmuxWork.sh use tmux-work.conf both enable and run separate sessions. how to go about doing this without problems?
Maybe Next TmuxTty.sh or TmuxDev.sh etc...
fine on arch wiki site:
https://wiki.archlinux.org/index.php/Tmux
it differences now then what it was before
tmux session
tmux session
edited Jan 5 at 2:51
K.D.G
asked Jan 5 at 2:17
K.D.GK.D.G
537
537
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You can simply pass the appropriate arguments to the two tmux
calls:
- Pass
tmux
the custom config file using the-f
argument totmux
itself. - For
new-session
, you should pass the session name using the-s
argument. - For
attach
, you pass the session name through-t
("t" for "target").
Putting it all together:
# TmuxWork.sh
if which tmux >/dev/null 2>&1; then
#if not inside a tmux session, and if no session is started, start a new session
test -z "$TMUX" && (
tmux -f ~/.tmux-work.conf attach -t work ||
tmux -f ~/.tmux-work.conf new-session -s work
)
fi
(You probably only need to pass the config file to new-session
, since in most cases it doesn't matter for other commands such as attach
or commands that run inside the session.)
You can extend this script to actually switch to session "work" if you execute it from inside session "home" or another session, by using the switch-client
command:
if test -n "$TMUX" ; then
tmux switch-client -t work
else
tmux attach -t work ||
tmux -f ~/.tmux-work.conf new-session -s work
fi
With some scripting, you might be able to store the session name ("work" in this example) and the custom config file name in shell variables and reuse this snippet to have custom scripts for the many sessions you would like to manage.
# TmuxWork.sh: does not work if TmuxHome.sh are running.. # TmuxHome.sh: does not work if TmuxWork are running.. # TmuxSwitch.sh: only work if TmuxWork are already running..
– K.D.G
Jan 5 at 18:01
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f492617%2fhow-can-start-multiple-tmux-autoscript%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You can simply pass the appropriate arguments to the two tmux
calls:
- Pass
tmux
the custom config file using the-f
argument totmux
itself. - For
new-session
, you should pass the session name using the-s
argument. - For
attach
, you pass the session name through-t
("t" for "target").
Putting it all together:
# TmuxWork.sh
if which tmux >/dev/null 2>&1; then
#if not inside a tmux session, and if no session is started, start a new session
test -z "$TMUX" && (
tmux -f ~/.tmux-work.conf attach -t work ||
tmux -f ~/.tmux-work.conf new-session -s work
)
fi
(You probably only need to pass the config file to new-session
, since in most cases it doesn't matter for other commands such as attach
or commands that run inside the session.)
You can extend this script to actually switch to session "work" if you execute it from inside session "home" or another session, by using the switch-client
command:
if test -n "$TMUX" ; then
tmux switch-client -t work
else
tmux attach -t work ||
tmux -f ~/.tmux-work.conf new-session -s work
fi
With some scripting, you might be able to store the session name ("work" in this example) and the custom config file name in shell variables and reuse this snippet to have custom scripts for the many sessions you would like to manage.
# TmuxWork.sh: does not work if TmuxHome.sh are running.. # TmuxHome.sh: does not work if TmuxWork are running.. # TmuxSwitch.sh: only work if TmuxWork are already running..
– K.D.G
Jan 5 at 18:01
add a comment |
You can simply pass the appropriate arguments to the two tmux
calls:
- Pass
tmux
the custom config file using the-f
argument totmux
itself. - For
new-session
, you should pass the session name using the-s
argument. - For
attach
, you pass the session name through-t
("t" for "target").
Putting it all together:
# TmuxWork.sh
if which tmux >/dev/null 2>&1; then
#if not inside a tmux session, and if no session is started, start a new session
test -z "$TMUX" && (
tmux -f ~/.tmux-work.conf attach -t work ||
tmux -f ~/.tmux-work.conf new-session -s work
)
fi
(You probably only need to pass the config file to new-session
, since in most cases it doesn't matter for other commands such as attach
or commands that run inside the session.)
You can extend this script to actually switch to session "work" if you execute it from inside session "home" or another session, by using the switch-client
command:
if test -n "$TMUX" ; then
tmux switch-client -t work
else
tmux attach -t work ||
tmux -f ~/.tmux-work.conf new-session -s work
fi
With some scripting, you might be able to store the session name ("work" in this example) and the custom config file name in shell variables and reuse this snippet to have custom scripts for the many sessions you would like to manage.
# TmuxWork.sh: does not work if TmuxHome.sh are running.. # TmuxHome.sh: does not work if TmuxWork are running.. # TmuxSwitch.sh: only work if TmuxWork are already running..
– K.D.G
Jan 5 at 18:01
add a comment |
You can simply pass the appropriate arguments to the two tmux
calls:
- Pass
tmux
the custom config file using the-f
argument totmux
itself. - For
new-session
, you should pass the session name using the-s
argument. - For
attach
, you pass the session name through-t
("t" for "target").
Putting it all together:
# TmuxWork.sh
if which tmux >/dev/null 2>&1; then
#if not inside a tmux session, and if no session is started, start a new session
test -z "$TMUX" && (
tmux -f ~/.tmux-work.conf attach -t work ||
tmux -f ~/.tmux-work.conf new-session -s work
)
fi
(You probably only need to pass the config file to new-session
, since in most cases it doesn't matter for other commands such as attach
or commands that run inside the session.)
You can extend this script to actually switch to session "work" if you execute it from inside session "home" or another session, by using the switch-client
command:
if test -n "$TMUX" ; then
tmux switch-client -t work
else
tmux attach -t work ||
tmux -f ~/.tmux-work.conf new-session -s work
fi
With some scripting, you might be able to store the session name ("work" in this example) and the custom config file name in shell variables and reuse this snippet to have custom scripts for the many sessions you would like to manage.
You can simply pass the appropriate arguments to the two tmux
calls:
- Pass
tmux
the custom config file using the-f
argument totmux
itself. - For
new-session
, you should pass the session name using the-s
argument. - For
attach
, you pass the session name through-t
("t" for "target").
Putting it all together:
# TmuxWork.sh
if which tmux >/dev/null 2>&1; then
#if not inside a tmux session, and if no session is started, start a new session
test -z "$TMUX" && (
tmux -f ~/.tmux-work.conf attach -t work ||
tmux -f ~/.tmux-work.conf new-session -s work
)
fi
(You probably only need to pass the config file to new-session
, since in most cases it doesn't matter for other commands such as attach
or commands that run inside the session.)
You can extend this script to actually switch to session "work" if you execute it from inside session "home" or another session, by using the switch-client
command:
if test -n "$TMUX" ; then
tmux switch-client -t work
else
tmux attach -t work ||
tmux -f ~/.tmux-work.conf new-session -s work
fi
With some scripting, you might be able to store the session name ("work" in this example) and the custom config file name in shell variables and reuse this snippet to have custom scripts for the many sessions you would like to manage.
answered Jan 5 at 8:11
filbrandenfilbranden
7,4002837
7,4002837
# TmuxWork.sh: does not work if TmuxHome.sh are running.. # TmuxHome.sh: does not work if TmuxWork are running.. # TmuxSwitch.sh: only work if TmuxWork are already running..
– K.D.G
Jan 5 at 18:01
add a comment |
# TmuxWork.sh: does not work if TmuxHome.sh are running.. # TmuxHome.sh: does not work if TmuxWork are running.. # TmuxSwitch.sh: only work if TmuxWork are already running..
– K.D.G
Jan 5 at 18:01
# TmuxWork.sh: does not work if TmuxHome.sh are running.. # TmuxHome.sh: does not work if TmuxWork are running.. # TmuxSwitch.sh: only work if TmuxWork are already running..
– K.D.G
Jan 5 at 18:01
# TmuxWork.sh: does not work if TmuxHome.sh are running.. # TmuxHome.sh: does not work if TmuxWork are running.. # TmuxSwitch.sh: only work if TmuxWork are already running..
– K.D.G
Jan 5 at 18:01
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f492617%2fhow-can-start-multiple-tmux-autoscript%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown