리눅스 상에서 입력값을 자동으로 받게 하는 방법이 있나요?

bsjun의 이미지

무슨뜻이냐면

만약에 제가 어떤 프로그램을 리눅스 상에서 실행 시켰는데 (설치 프로그램 등..)

프로그램 구동되는 중간에 사용자로부터 입력을 받아야 하는 경우에

제가 지정해놓은 값으로 자동으로 입력되게 하는 방법이 없을까요?

예를들면요,

Install.sh 라는 프로그램을 실행 했는데 중간에

디렉토리를 입력하세요 :

라는 입력을 받는 상황이 나와서 이부분을 자동으로 입력되게 하고싶은 것입니다..

이런식으로 입력하게 해서 Install.sh /var/www/abc/

디렉토리를 입력하세요 : /var/www/abc

이렇게 자동으로 되게요..

왜 이런 질문을 하냐면 현재 쓰려고 하는 프로그램이 아마도 .so 파일인데

nm 으로 실행시켜서 살펴봐도 잘 모르겠습니다 ㅠㅠ.. 근데 스크립트 내용을 바꿀 필요는 없고..

자동화만 시켜서 사용하고싶은데 어렵네요..

bsjun의 이미지

nm 으로 이 파일을 열었을 시에 이렇게 나옵니다.

000000000069b308 d _DYNAMIC
000000000069b4d0 d _GLOBAL_OFFSET_TABLE_
0000000000403890 t _GLOBAL__I__ZN5ArrayC2Eii
000000000048b9f0 R _IO_stdin_used
w _Jv_RegisterClasses
U _Unwind_Resume@@GCC_3.0
0000000000404b00 T _Z10is_integerPA3_d
0000000000404ca0 T _Z10is_integerPd
000000000040c0e0 T _Z10update_bitSt6vectorIiSaIiEERS1_Ri
00000000004165c0 T _Z10write_scelSt6vectorI9structureSaIS0_EE
00000000004029e0 T _Z11determinantPA3_d
0000000000404400 T _Z11distance_pl5ArrayS_S_
0000000000402a50 T _Z11matrix_multPA3_dS0_S0_
0000000000413e80 T _Z11read_cspecsRSt6vectorIdSaIdEE
000000000041c940 T _Z11write_clust9multipletSs
0000000000404940 T _Z12latticeparamPA3_dPdS1_
0000000000404620 T _Z12latticeparamPA3_dPdS1_Pi
0000000000405fc0 T _Z12new_mc_indexSt6vectorI8mc_indexSaIS0_EES0_
0000000000413cb0 T _Z12read_oszicarSsRd
0000000000413ac0 T _Z12read_oszicarSsRdRi
000000000041c2f0 T _Z12write_fclust9multipletSs
000000000042db50 T _Z13get_loc_equivR5orbitRSt6vectorI6sym_opSaIS2_EE
000000000040ce80 T _Z13int_to_stringiRSsi
0000000000406b70 T _Z13lat_dimensionPA3_ddPi
0000000000418320 T _Z13new_loc_clust7cluster5orbit
000000000042d720 T _Z13new_loc_clust7clusterSt6vectorI5orbitSaIS1_EE
00000000004212d0 T _Z13read_mc_inputSsRiS_S_S_S_RdS0_S0_S0_R7chempotS2_S2_RSt6vectorIS1_SaIS1_EES_S_S_
0000000000404110 T _Z13scandirectorySsSs
000000000040ef00 T _Z14get_clust_func7atomposS_Rd
0000000000406dc0 T _Z15coord_trans_matPA3_dS0_S0_
0000000000450c50 T _Z15get_corr_vectorR9structureR9multipletRSt6vectorIS3_IS3_IS3_IiSaIiEESaIS5_EESaIS7_EESaIS9_EE
000000000040d0a0 T _Z16double_to_stringdRSsi
0000000000448090 T _Z16merge_multiplets9multipletS_RS_
000000000041b4e0 T _Z17calc_correlations9structure9multipletR11arrangement
0000000000410ef0 T _Z17get_basis_vectorsR7atompos
0000000000448d60 T _Z18generate_ext_basis9structure9multipletRS0_
0000000000449ae0 T _Z18generate_ext_clust9structureiiSt6vectorIdSaIdEER9multiplet
0000000000468940 T _Z18generate_loc_clust9structureiiSt6vectorIdSaIdEER9multiplet7cluster

이런식으로 600줄 정도 되네요..

get_ 으로 시작되는게 입력받는거 같기도하고..

백연구원의 이미지

하시려는게 심볼을 확인하는 nm명령어와는 거리가 있는데.. expect 쪽을 알아보세요.

특정 문자열(디렉토리를 입력하세요: 같은)이 출력되면 지정된 string(/var/www/abc/)을 자동으로 입력해주는 개념입니다.


소곤소곤

bsjun의 이미지

감사합니다! 이거로 하면 될것 같습니다.

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.