Giter Site home page Giter Site logo

minishell's People

Contributors

hiroshi-kubota-rh avatar

Watchers

 avatar

minishell's Issues

exportの実装

  • export <文字列(=なし)>,文字列がすでに存在するshell変数の場合には環境変数への格上げが行われる.
  • export <文字列(=なし)>,文字列がshell変数として存在しない場合には,一旦shell変数に保存される.文字列への値の代入が行われたら,その代入と同時に環境変数に格上げされる.
  • export <文字列(=あり)>,key=valueとして最初のイコールで文字列を区切り,環境変数に保存する.
  • exportのみでの実行時には,shell変数をdeclare -x ~の形で出力
  • exportは1つ以上の引数を取ることが可能で,引数として与えられた文字列内に=があるかないかでshell変数か環境変数かに保存が行われる.

echoの作成

  • echo "fewa"echo fewa testなどで,arg を空白で区切って出力し、最後に改行を出力する.
  • argが複数ある場合,間のスペースの数は全て1つで出力される.
  • -nオプションをつけた際には,改行が不要となる.
  • exit statusがきちんと実装できているかの確認
  • 終了ステータスは常に0である.
  • Not interpret unclosed quotes or special characters which are not required by the subject such as \ (backslash) or ; (semicolon).(課題文より引用)なので,以下の出力が正しいものとなる
$>echo '"` a
'"` a
  • ダブルクオートやシングルクオートに対する対応が適切になされているかを確認する.(以下Guacamole bash挙動)
$>echo test test
test test
$>echo "test test"
test test
$> echo 'test test'
test test

exitの作成

  • exitの実行で,$?に最後に実行したコマンドの終了ステータスを格納し,shellのプログラムを終了する.

以下はGuacamoleのbash(GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)
Copyright (C) 2007 Free Software Foundation, Inc.)での挙動

  • 第二引数にlong(-9223372036854775808 ~ 9223372036854775807)範囲の数が与えられた時には,0~255(unsigned charにcast?)に読み替えられたステータスコードが$?に格納され,bashが終了する.
  • 第二引数にlong(-9223372036854775808 ~ 9223372036854775807)範囲外の数,または,数字以外のものが与えられた場合には以下をを出力し,bashは終了しない
$>exit <第二引数>
exit
bash: exit: <第二引数>: numeric argument required
  • 引数が2つ以上与えられた場合には以下を出力し,bashは終了しない.
exit
bash: exit: too many arguments

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.