xterm -e 사용할 때 조언 구합니다.

lightoml의 이미지

xterm을 실행할 때 환경변수를 저장해서 쓰고 싶은데요..

그래서 xterm -e 라는 옵션을 사용하려고 하는데.. 가령

xterm -e setenv name xxx

이렇게 사용하고 싶은데, -e옵션 에러메세지가 setenv의 절대경로를 앞에 넣어줘야 한다고 나오는데,
setenv는 쉘명령어라서 어떻게 해야할 지 모르겠네요..

만약 vi를 연결해서 쓰고 싶으면

xterm -e /usr/bin/vi xxx.c

라고 하면 xterm이 뜨자마자 xxx.c가 vi로 열리거든요..

혹시 고수님들 어떻게 해야 하는 지 아시나요?

답변 부탁드립니다..

sio4의 이미지

쩝... 쓰다가 날려먹어서 엄청스레 쓰기 싫어지는군요. :-(

1. xterm의 -e 옵션

이 옵션은 xterm으로 하여금 shell을 실행하는 대신에 지정한 프로그램을 실행하도록 해줍니다. 그리고 보통의 경우에 쉘을 닫으면 터미널이 닫히듯이, 지정한 프로그램이 실행을 끝내면 터미널도 종료합니다. 예들들어,

% xterm &
% xterm -e top &
% ps axf
...
19498 pts/38   Ss     0:02  \_ -csh
17470 pts/38   S      0:00  |   \_ xterm
17472 pts/39   Ss     0:00  |   |   \_ -csh
17493 pts/39   S+     0:00  |   |       \_ top
17490 pts/38   S      0:00  |   \_ xterm -e top
17492 pts/42   Ss+    0:00  |   |   \_ top
17497 pts/38   R+     0:00  |   \_ ps axf
...

이런 식의 프로세스 뭉치가 만들어집니다.

2. 환경변수

원하는 작업은, 아마도, 경우에 따라서 어떤 xterm은 그 터미널의 특정 환경을 갖도록 하고싶은... 일반 작업을 위한 터미널은 일반 환경을, 특정 작업을 위한 터미널은 그 작업에 필요한 환경을 따로 주기 위함인것 같은데,

1) 간단히, special_env.csh 파일을 만들어두고 터미널을 띄운 후 이 파일을 sourcing 한다. 확실한 방법이고 유동적이므로 이 방식을 사용하지 않을 이유가 별로 없을것 같습니다.

2) 간단히, special_term.sh 파일을 만들고 다음의 내용을 넣는다. 이미 실행하는 터미널의 성격을 바꾸지 못하는 단점은 있지만... 나름대로...

#!/bin/csh
 
setenv MY_ENV "xxx"
setenv MY_ROOT /var/my_root
 
xterm

3) 또는... 질문에서 사용된 형식과 비슷하게...

% env MY_ENV="xxx" xterm

에궁... 퇴근시간이 넘어버렸네... 이만.

--
"The love you take is equal to the love you make." The End, by Beatles

lightoml의 이미지

저때문에 퇴근도 늦게 하시고... 죄송하네요..

오늘 하루종일 고생했는데, 정말 큰 도움이 되었습니다..

좋은 하루되세요.. :)

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.