Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@usagi
Created April 13, 2012 01:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save usagi/2372494 to your computer and use it in GitHub Desktop.
Save usagi/2372494 to your computer and use it in GitHub Desktop.
/bin/shの任意番目(例えば$argc=2)の引数へさくっとアクセスするテスト
#/bin/sh
argc=2
echo '/bin/shの任意番目(例えば$argc=2)の引数へさくっとアクセスするテスト'
eval echo \$$argc
@usagi
Copy link
Author

usagi commented Apr 13, 2012

LH-MAIN /tmp% cat sh_argv_argc_sample.sh

/bin/sh

argc=2

echo '/bin/shの任意番目(例えば$argc=2)の引数へさくっとアクセスするテスト'
eval echo $$argc

LH-MAIN /tmp% ./sh_argv_argc_sample.sh aaa bbb ccc
/bin/shの任意番目(例えば$argc=2)の引数へさくっとアクセスするテスト
bbb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment