You are not logged in.

#1 2014-07-21 19:42:27

KdgDev
Member
Registered: 2014-07-21
Posts: 3

Calling text editor via alias closes the terminal.

I installed Sublime Text 3 from the Tarball, moved it to /opt and then made an alias in my bashrc file so that I can call it from the terminal.

Problem is, doing this closes the terminal. And it's also not restored when sublime closes. I would expect the terminal to just wait for sublime to quit. I the mean time I could open another terminal tab to do other things, but as I said: the terminal window closes.

The alias I added is:

# Aliases
alias sublime="exec /opt/sublime_text_3/sublime_text"

Can anyone explain why I'm getting this behavior?

Offline

#2 2014-07-21 19:53:01

alphaniner
Member
From: Ancapistan
Registered: 2010-07-12
Posts: 2,810

Re: Calling text editor via alias closes the terminal.

Why do you think you need to run it with exec?

Last edited by alphaniner (2014-07-21 19:53:11)


But whether the Constitution really be one thing, or another, this much is certain - that it has either authorized such a government as we have had, or has been powerless to prevent it. In either case, it is unfit to exist.
-Lysander Spooner

Offline

#3 2014-07-21 20:39:22

KdgDev
Member
Registered: 2014-07-21
Posts: 3

Re: Calling text editor via alias closes the terminal.

alphaniner wrote:

Why do you think you need to run it with exec?

Why do you think I asked the question?

Offline

#4 2014-07-21 21:58:47

SolarBoyMatt
Member
Registered: 2012-01-07
Posts: 263

Re: Calling text editor via alias closes the terminal.

man exec

will tell you why.

Offline

#5 2014-07-21 22:04:43

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,613
Website

Re: Calling text editor via alias closes the terminal.

Welcome to the forum KdgDev,  the brief posts are meant to be unwelcoming - but really do point you to the problem.

You should be able to experiment to prove to yourself that this has nothing to do with it being an alias.  if you enter the part in quotes as a command, it will do exactly the same thing.  That's what exec does (for more detail, please do check out the man page as recommended).

What you put after the equals sign for an alias should be exactly what you'd type on the command line to get the results you want.

-- mod note: moving to Newbie Corner --


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#6 2014-07-22 05:45:22

orschiro
Member
Registered: 2009-06-04
Posts: 2,136
Website

Re: Calling text editor via alias closes the terminal.

Side question:

Why don't you install the sublime package from the AUR?

https://aur.archlinux.org/packages/sublime-text/

Offline

#7 2014-07-22 14:03:24

KdgDev
Member
Registered: 2014-07-21
Posts: 3

Re: Calling text editor via alias closes the terminal.

orschiro wrote:

Side question:

Why don't you install the sublime package from the AUR?

https://aur.archlinux.org/packages/sublime-text/

First time trying Arch, wasn't aware of the package browser.

And yes, this page explained it quite nicely: http://ss64.com/bash/exec.html

Don't have access to my machine right now. When I get home I'll try setting the script to executable and adding the directory to the bashrc PATH.

I'd just like to mention that I installed Arch on Virtualbox, purely because I'm interested in seeing how it works. I'll be sticking to Ubuntu in professional capacity for a while tongue

Last edited by KdgDev (2014-07-22 14:10:50)

Offline

Board footer

Powered by FluxBB