SlideShare a Scribd company logo
1 of 24
Download to read offline
アルゴリズムとデータ構造

  2011.10.14(WEB用)
今日の内容
• パスについてもう少し詳しく
  (絶対パス、相対パス)

• Cygwinの基本コマンドその4

• Meadowでプログラムを書いてみる
パスの表現
                       /cygdrive/c


                            *
                           home      ←   *はカレントディレクトリ
                                         つまり現在居るディレクトリを示す

                       algo2011


          Oct        Nov          Dec        Jan



 7   14         21    28


前回の授業で上のようなディレクトリ構造を作成しました。
パスの表現
                       /cygdrive/c


                            *
                           home


                       algo2011


          Oct        Nov          Dec   Jan



 7   14         21    28


例えば、今日の日付のディレクトリに移動したい場合は…
パスの表現
                          /cygdrive/c


                               *
                              home


                          algo2011


             Oct        Nov          Dec   Jan



   7    14         21    28


~/02:01:10> cd /cygdrive/c/home/algo2011/Oct/7
パスの表現
                          /cygdrive/c


                               *
                              home


                          algo2011


             Oct        Nov          Dec   Jan



   7    14         21    28
                                     ↓ とっても長々しい!
~/02:01:10> cd /cygdrive/c/home/algo2011/Oct/7
パスの表現
                          /cygdrive/c

                                           カレントディレクトリを
                               *
                              home         起点とすれば短い
                                           パスで記述が出来る
                          algo2011


             Oct        Nov          Dec      Jan



   7    14         21    28
                        ↓ homeディレクトリ以下のパスのみ記述
~/02:01:10> cd algo2011/Oct/7
絶対パスと相対パス
ルートディレクトリ(/cygdrive/c) から                      /cygdrive/c
対象ディレクトリまでの全ディレクトリを
用いて表現したパスを 絶対パス と呼ぶ                                *
                                                 home

> cd /cygdrive/c/home/algo2011/Oct/7
                                                algo2011


                                 Oct



                          7   = /cygdrive/c/home/algo2011/Oct/7
絶対パスと相対パス

カレントディレクトリを基準として、対象ディレ
クトリを表したものを 相対パス と呼ぶ                             *
                                              home

> cd algo2011/Oct/7
                                             algo2011


                             Oct



                      7   = algo2011/Oct/7
絶対パスと相対パス


ポイント:
相対パスはカレントディレクトリの位置に                home
よって変わるが、絶対パスはどの位置に
                                      *
居ても変わらない                          algo2011


                   Oct


                = /cygdrive/c/home/algo2011/Oct/7
            7
                = Oct/7
特殊なディレクトリのパス
表記の仕方           意味

        ルートディレクトリを表す
  /     (= /cygdrive/c)
        ホームディレクトリを表す
 ~/     (= /cygdrive/c/home)
        カレントディレクトリを表す
 ./     (=現在居るディレクトリ)
        親ディレクトリを表す
 ../    (ひとつ上の階層のディレクトリ)
特殊なディレクトリのパス
表記の仕方           意味

        ルートディレクトリを表す
  /     (= /cygdrive/c)
                               絶
                               対
        ホームディレクトリを表す           パ
 ~/     (= /cygdrive/c/home)
                               ス

        カレントディレクトリを表す
 ./     (=現在居るディレクトリ)
        親ディレクトリを表す
 ../    (ひとつ上の階層のディレクトリ)
特殊なディレクトリのパス
表記の仕方           意味

        ルートディレクトリを表す
  /     (= /cygdrive/c)
        ホームディレクトリを表す
 ~/     (= /cygdrive/c/home)
        カレントディレクトリを表す
 ./     (=現在居るディレクトリ)
                               相
                               対
        親ディレクトリを表す             パ
 ../    (ひとつ上の階層のディレクトリ)
                               ス
問題1
以下の状態のとき、「7」         C:¥ or D:¥

ディレクトリの絶対パスと
相対パスを表現しなさい            home


                     algo2011



    Oct
          *    Nov                Dec   Jan



7   14    21
問題1:答え
以下の状態のとき、「7」           C:¥ or D:¥

ディレクトリの絶対パスと
相対パスを表現しなさい              home


                       algo2011



    Oct
          *      Nov                Dec        Jan



7   14    21   絶対パス -> /cygdrive/c/home/algo2011/Oct/7
               相対パス -> 7
問題2
以下の状態のとき、「Nov」       C:¥ or D:¥

ディレクトリの絶対パスと
相対パスを表現しなさい            home


                     algo2011



    Oct
          *    Nov                Dec   Jan



7   14    21
問題2:答え
以下の状態のとき、「Nov」         C:¥ or D:¥

ディレクトリの絶対パスと
相対パスを表現しなさい              home


                       algo2011



    Oct
          *      Nov                Dec        Jan



7   14    21   絶対パス -> /cygdrive/c/home/algo2011/Nov/
               相対パス -> ../Nov/
問題3
以下の状態のとき、「Jan」         C:¥ or D:¥

ディレクトリの絶対パスと
相対パスを表現しなさい              home


                       algo2011



      Oct        Nov                Dec   Jan



7
  *   14    21
問題3:答え
以下の状態のとき、「Jan」           C:¥ or D:¥

ディレクトリの絶対パスと
相対パスを表現しなさい                home


                         algo2011



      Oct          Nov                Dec         Jan



7
  *   14    21   絶対パス -> /cygdrive/c/home/algo2010/Jan/
                 相対パス -> ../../Jan/
Cygwin基本コマンド 4
mv: ファイルやディレクトリの名称変更/移動
  ~/02:01:10> mv abc xyz    ← abc を xyz に名称変更

  ~/02:01:10> mv abc xyz/   ← abc を xyz の中に移動
                違いに注意!


移動先である “xyz” はディレクトリでなければならない。
mvコマンド:名前変更
                     *
                   home



                   abc


     abc ディレクトリの名称を xyz に変更したいとき


~/02:01:10> mv abc xyz
mvコマンド:名前変更
                      *
                   home



                    xyz




~/02:01:10> mv abc xyz
`abc’ -> `xyz’ ← 出力
mvコマンド:場所移動
                       *
                     home



               abc          xyz



 abc ディレクトリを xyz ディレクトリの中に移動したいとき


~/02:01:10> mv abc xyz/
mvコマンド:場所移動
                        *
                      home



                abc          xyz



                             abc

~/02:01:10> mv abc xyz/
`abc’ -> `xyz’/abc’ ← 出力

More Related Content

Recently uploaded

Recently uploaded (6)

次世代機の製品コンセプトを描く ~未来の機械を創造してみよう~
次世代機の製品コンセプトを描く ~未来の機械を創造してみよう~次世代機の製品コンセプトを描く ~未来の機械を創造してみよう~
次世代機の製品コンセプトを描く ~未来の機械を創造してみよう~
 
世界を変えるクレーンを生み出そう! 高知エンジニアリングキャンプ2024プログラム
世界を変えるクレーンを生み出そう! 高知エンジニアリングキャンプ2024プログラム世界を変えるクレーンを生み出そう! 高知エンジニアリングキャンプ2024プログラム
世界を変えるクレーンを生み出そう! 高知エンジニアリングキャンプ2024プログラム
 
2024年度 東京工業大学 工学院 機械系 大学院 修士課程 入試 説明会 資料
2024年度 東京工業大学 工学院 機械系 大学院 修士課程 入試 説明会 資料2024年度 東京工業大学 工学院 機械系 大学院 修士課程 入試 説明会 資料
2024年度 東京工業大学 工学院 機械系 大学院 修士課程 入試 説明会 資料
 
東京工業大学 環境・社会理工学院 建築学系 大学院入学入試・進学説明会2024_v2
東京工業大学 環境・社会理工学院 建築学系 大学院入学入試・進学説明会2024_v2東京工業大学 環境・社会理工学院 建築学系 大学院入学入試・進学説明会2024_v2
東京工業大学 環境・社会理工学院 建築学系 大学院入学入試・進学説明会2024_v2
 
ゲーム理論 BASIC 演習106 -価格の交渉ゲーム-#ゲーム理論 #gametheory #数学
ゲーム理論 BASIC 演習106 -価格の交渉ゲーム-#ゲーム理論 #gametheory #数学ゲーム理論 BASIC 演習106 -価格の交渉ゲーム-#ゲーム理論 #gametheory #数学
ゲーム理論 BASIC 演習106 -価格の交渉ゲーム-#ゲーム理論 #gametheory #数学
 
生成AIの回答内容の修正を課題としたレポートについて:お茶の水女子大学「授業・研究における生成系AIの活用事例」での講演資料
生成AIの回答内容の修正を課題としたレポートについて:お茶の水女子大学「授業・研究における生成系AIの活用事例」での講演資料生成AIの回答内容の修正を課題としたレポートについて:お茶の水女子大学「授業・研究における生成系AIの活用事例」での講演資料
生成AIの回答内容の修正を課題としたレポートについて:お茶の水女子大学「授業・研究における生成系AIの活用事例」での講演資料
 

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

2011年10月14日