├── .github └── workflows │ ├── latest_game_archive.yml │ ├── tag_release.yml │ └── tests.yml ├── .gitignore ├── Dockerfile ├── Images ├── gameshell_first_mission_small.gif ├── illustration-small.png └── illustration.jpg ├── LICENSE ├── Makefile ├── README-fr.md ├── README-it.md ├── README.md ├── doc ├── README.md ├── deps.md ├── dev_manual.md ├── faq.md ├── gameshell.md ├── i18n.md ├── misc.md ├── mission.md ├── mission_ideas.md └── user_manual.md ├── i18n ├── en.po ├── fr.po ├── gameshell-full-help │ ├── en.txt │ ├── fr.txt │ └── it.txt ├── gameshell-help │ ├── en.txt │ ├── fr.txt │ └── it.txt ├── gameshell-init-msg-short │ ├── en.txt │ ├── fr.txt │ └── it.txt ├── gameshell-init-msg │ ├── en.txt │ ├── fr.txt │ └── it.txt ├── gameshell-welcome │ ├── en.txt │ ├── fr.txt │ └── it.txt ├── it.po ├── start-full-help │ ├── en.txt │ ├── fr.txt │ └── it.txt ├── start-help │ ├── en.txt │ ├── fr.txt │ └── it.txt └── template.pot ├── lib ├── ascii-art │ ├── GameShell.txt │ ├── titlescreen │ └── treasure-chest.txt ├── bashrc ├── bin_test.sh ├── boxes.db ├── gsh.sh ├── gshrc ├── header.sh ├── mission_source.sh ├── profile.sh └── zshrc ├── missions ├── FINAL_MISSION │ ├── Makefile │ ├── check.sh │ ├── goal.sh │ ├── goal │ │ ├── en.txt │ │ ├── fr.txt │ │ └── it.txt │ ├── i18n │ │ ├── en.po │ │ ├── fr.po │ │ ├── it.po │ │ └── template.pot │ ├── init.sh │ └── msg │ │ ├── en.txt │ │ ├── fr.txt │ │ └── it.txt ├── basic │ ├── 01_cd_tower │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ └── test.sh │ ├── 02_cd.._cellar │ │ ├── Makefile │ │ ├── ascii-art │ │ │ └── apple.txt │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── static.sh │ │ └── test.sh │ ├── 03_cd_HOME_throne │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── static.sh │ │ ├── test.sh │ │ ├── treasure-msg │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ └── treasure.sh │ ├── 04_mkdir_chest │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── gshrc │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── static.sh │ │ └── test.sh │ ├── 05_rm_spiders_cellar │ │ ├── Makefile │ │ ├── ascii-art │ │ │ ├── bat-0.txt │ │ │ ├── bat-1.txt │ │ │ ├── bat-2.txt │ │ │ ├── spider-0.txt │ │ │ ├── spider-1.txt │ │ │ └── spider-2.txt │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ └── test.sh │ ├── 06_mv_coins_garden │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ └── test.sh │ ├── 07_mv_hidden_coins_garden │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ └── test.sh │ ├── 08_rm_wildcard_spiders_cellar │ │ ├── Makefile │ │ ├── ascii-art │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ └── test.sh │ ├── 09_rm_wildcard_hidden_spiders_cellar │ │ ├── Makefile │ │ ├── ascii-art │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ ├── test.sh │ │ ├── treasure-msg │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ └── treasure.sh │ ├── 10_cp_standard_great_hall │ │ ├── Makefile │ │ ├── ascii-art │ │ │ ├── armour.txt │ │ │ ├── shield.txt │ │ │ └── stag_head.txt │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── clean0.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── init0.sh │ │ ├── static.sh │ │ └── test.sh │ ├── 11_cp_wildcards_tapestries_great_hall │ │ ├── Makefile │ │ ├── ascii-art │ │ │ ├── tapestry-0.txt │ │ │ ├── tapestry-1.txt │ │ │ ├── tapestry-2.txt │ │ │ ├── tapestry-3.txt │ │ │ └── tapestry-4.txt │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── clean0.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── init0.sh │ │ ├── static.sh │ │ └── test.sh │ ├── 12_cp_ls_mtime_paintings_tower │ │ ├── Makefile │ │ ├── ascii-art │ │ │ ├── painting-1 │ │ │ ├── painting-2 │ │ │ └── painting-3 │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ └── test.sh │ └── default.idx ├── contrib │ └── .keep ├── default.idx ├── finding_files_maze │ ├── 00_shared │ │ ├── Makefile │ │ ├── ascii-art │ │ │ ├── bucket.txt │ │ │ ├── flowers.txt │ │ │ └── wheelbarrow.txt │ │ ├── clean.sh │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── sbin │ │ │ ├── generate_maze.awk │ │ │ └── generate_maze.sh │ │ └── static.sh │ ├── 01_ls_cd │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ ├── test.sh │ │ ├── treasure-msg.sh │ │ ├── treasure-msg │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ └── treasure.sh │ ├── 02_tree │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ └── test.sh │ ├── 03_find_1 │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ └── test.sh │ ├── 04_find_2 │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ └── test.sh │ ├── 05_find_xargs_grep │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ └── test.sh │ └── default.idx ├── intermediate │ ├── 01_alias_la │ │ ├── Makefile │ │ ├── ascii-art │ │ │ └── diamond.txt │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── goal.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── test.sh │ │ └── treasure.sh │ ├── 02_alias_journal │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── gshrc │ │ │ ├── en.sh │ │ │ ├── fr.sh │ │ │ └── it.sh │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ ├── test.sh │ │ ├── treasure-msg │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ └── treasure.sh │ ├── 03_tab_spider_lair │ │ ├── Makefile │ │ ├── ascii-art │ │ │ ├── baby-bat.txt │ │ │ └── spider-queen.txt │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ └── test.sh │ ├── 04_bg_xeyes │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── gshrc │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── skip │ │ │ ├── en.txt │ │ │ └── fr.txt │ │ └── test.sh │ ├── 05_background │ │ ├── Makefile │ │ ├── ascii-art │ │ │ ├── f1 │ │ │ ├── f2 │ │ │ ├── f3 │ │ │ ├── f4 │ │ │ ├── f5 │ │ │ └── f6 │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── flarigo.sh │ │ ├── goal.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ └── test.sh │ ├── 06_control-C │ │ ├── Makefile │ │ ├── ascii-art │ │ │ ├── explosion.txt │ │ │ └── fireworks.txt │ │ ├── auto.sh │ │ ├── charmiglio.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ └── test.sh │ └── default.idx ├── misc │ ├── 01_cal_nostradamus │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── skip │ │ │ ├── en.txt │ │ │ └── fr.txt │ │ └── test.sh │ ├── 02_nano_journal │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ └── test.sh │ ├── 03_tr_caesar_shift │ │ ├── Makefile │ │ ├── ascii-art │ │ │ ├── bottle.txt │ │ │ ├── ink_scroll.txt │ │ │ └── medal.txt │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── secret_recipe │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ └── static.sh │ └── default.idx ├── permissions │ ├── 01_chmod_x_dir_king_quarter │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ └── test.sh │ ├── 02_chmod_r_file_king_quarter │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ └── test.sh │ ├── 03_chmod_rw_file_dir_throne_room │ │ ├── Makefile │ │ ├── ascii-art │ │ │ └── crown.txt │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ └── test.sh │ └── default.idx ├── pipe_intro_book_of_potions │ ├── 00_shared │ │ ├── Makefile │ │ ├── ascii-art │ │ │ ├── cauldron.txt │ │ │ └── servillus.txt │ │ ├── book_of_potions │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── clean.sh │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── sbin │ │ │ └── install_potion_book.sh │ │ ├── static.sh │ │ ├── torn_page5 │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ └── torn_page6 │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ ├── 01_head │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ └── test.sh │ ├── 02_tail │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ └── test.sh │ ├── 03_cat │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ └── test.sh │ ├── 04_pipe │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ └── test.sh │ ├── 05_pipe_head_tail │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── static.sh │ │ └── test.sh │ ├── README.md │ └── default.idx ├── pipes_merchant_stall │ ├── 00_shared │ │ ├── Makefile │ │ ├── clean.sh │ │ ├── count_commands.sh │ │ ├── data │ │ │ ├── firstnames.en │ │ │ ├── firstnames.it │ │ │ ├── lastnames.en │ │ │ ├── lastnames.fr │ │ │ ├── lastnames.it │ │ │ ├── objects.en │ │ │ ├── objects.fr │ │ │ └── objects.it │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── sbin │ │ │ ├── generate_merchant_stall.awk │ │ │ └── generate_merchant_stall.sh │ │ └── static.sh │ ├── 01_pipe_1 │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ └── static.sh │ ├── 02_pipe_2 │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ └── static.sh │ └── default.idx ├── processes │ ├── 00_shared │ │ ├── init.sh │ │ ├── my_ps-linux │ │ ├── my_ps-macos │ │ ├── static.sh │ │ └── test-proc-name.sh │ ├── 01_ps_kill │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── deps.sh │ │ ├── goal.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── spell.c │ │ ├── spell.sh │ │ └── test.sh │ ├── 02_ps_kill_signal │ │ ├── Makefile │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── deps.sh │ │ ├── goal.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── init.sh │ │ ├── spell.c │ │ ├── spell.sh │ │ └── test.sh │ ├── 03_pstree_kill │ │ ├── Makefile │ │ ├── ascii-art │ │ │ ├── coal-0.txt │ │ │ ├── coal-1.txt │ │ │ ├── coal-2.txt │ │ │ ├── coal-3.txt │ │ │ ├── snowflake-0.txt │ │ │ ├── snowflake-1.txt │ │ │ ├── snowflake-2.txt │ │ │ └── snowflake-3.txt │ │ ├── auto.sh │ │ ├── check.sh │ │ ├── clean.sh │ │ ├── deps.sh │ │ ├── fairy │ │ │ └── spell.sh │ │ ├── goal │ │ │ ├── en.txt │ │ │ ├── fr.txt │ │ │ └── it.txt │ │ ├── i18n │ │ │ ├── en.po │ │ │ ├── fr.po │ │ │ ├── it.po │ │ │ └── template.pot │ │ ├── imp │ │ │ └── spell.sh │ │ ├── init.sh │ │ ├── mischievous_imp.sh │ │ ├── nice_fairy.sh │ │ ├── process.c │ │ ├── spell.c │ │ ├── static.sh │ │ └── test.sh │ └── default.idx └── stdin_stdout_stderr │ ├── 01_stdin_additions │ ├── Makefile │ ├── auto.sh │ ├── check.sh │ ├── clean.sh │ ├── goal │ │ ├── en.txt │ │ ├── fr.txt │ │ └── it.txt │ ├── i18n │ │ ├── en.po │ │ ├── fr.po │ │ ├── it.po │ │ └── template.pot │ └── init.sh │ ├── 02_stdin_redirection_multiplications │ ├── Makefile │ ├── auto.sh │ ├── check.sh │ ├── clean.sh │ ├── goal │ │ ├── en.txt │ │ ├── fr.txt │ │ └── it.txt │ ├── i18n │ │ ├── en.po │ │ ├── fr.po │ │ ├── it.po │ │ └── template.pot │ ├── init.sh │ └── static.sh │ ├── 03_stdout_redirection_inventory │ ├── Makefile │ ├── ascii-art │ │ └── candle.txt │ ├── auto.sh │ ├── check.sh │ ├── clean.sh │ ├── goal │ │ ├── en.txt │ │ ├── fr.txt │ │ └── it.txt │ ├── i18n │ │ ├── en.po │ │ ├── fr.po │ │ ├── it.po │ │ └── template.pot │ ├── init.sh │ └── static.sh │ ├── 04_stderr_dev-null_grimoires │ ├── Makefile │ ├── auto.sh │ ├── check.sh │ ├── clean.sh │ ├── goal │ │ ├── en.txt │ │ ├── fr.txt │ │ └── it.txt │ ├── i18n │ │ ├── en.po │ │ ├── fr.po │ │ ├── it.po │ │ └── template.pot │ ├── init.sh │ ├── static.sh │ └── test.sh │ ├── 05_stdout_stderr_redirection_merlin │ ├── Makefile │ ├── ascii-art │ │ └── moon.txt │ ├── auto.sh │ ├── check.sh │ ├── clean.sh │ ├── goal │ │ ├── en.txt │ │ ├── fr.txt │ │ └── it.txt │ ├── i18n │ │ ├── en.po │ │ ├── fr.po │ │ ├── it.po │ │ └── template.pot │ ├── init.sh │ ├── merlin.c │ ├── merlin.sh │ └── static.sh │ └── default.idx ├── scripts ├── RANDOM ├── _gsh_env ├── _gsh_goal ├── _gsh_index ├── _gsh_log ├── _gsh_log.awk ├── _gsh_pcm ├── _gsh_plm ├── _gsh_protect ├── _gsh_save ├── _gsh_stat ├── _gsh_stat.awk ├── _gsh_systemconfig ├── _gsh_unprotect ├── _gsh_version ├── _gsh_welcome ├── admin_mode ├── alt_history_start.sh ├── alt_history_stop.sh ├── box.awk ├── box.sh ├── check_file ├── checksum ├── color_echo ├── copy_bin ├── create_boxes_data.awk ├── fc-lnr.sh ├── generate_rcfile ├── gsh_gettext.sh ├── mainshell.sh ├── make_index ├── missiondir ├── missionname ├── mktemp ├── pager ├── parchment ├── print_current_environment.sh ├── progress_bar ├── progress_bar.sh ├── random_string ├── readlink-f ├── reflow.awk ├── rm ├── sed-i ├── seq ├── sign_file ├── text_size.awk ├── textdomainname ├── treasure_message └── wcwidth.awk ├── start.sh └── utils ├── archive.sh └── new_mission.sh /.github/workflows/tests.yml: -------------------------------------------------------------------------------- 1 | name: GameShell CI 2 | on: [push] 3 | jobs: 4 | test: 5 | strategy: 6 | matrix: 7 | platform: [ubuntu-latest, macos-latest] 8 | runs-on: ${{ matrix.platform }} 9 | steps: 10 | - name: Checkout the GameShell repo 11 | uses: actions/checkout@v4 12 | - if: ${{ matrix.platform == 'ubuntu-latest' }} 13 | name: Install Linux deps 14 | run: | 15 | sudo apt install gettext man-db psmisc nano tree bsdmainutils zsh 16 | # - if: ${{ matrix.platform == 'macos-latest' }} 17 | # name: Install macOS deps 18 | # run: | 19 | # brew install coreutils pstree tree man-db 20 | - name: Run the tests 21 | run: | 22 | make tests-bash && make tests-zsh 23 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Images/gsh-*-orig.gif 2 | tmp 3 | TODO 4 | .bin 5 | .sbin 6 | .config 7 | .tmp 8 | .save 9 | World 10 | locale/ 11 | *~ 12 | /gameshell* 13 | game shell* 14 | boxes-data.awk 15 | -------------------------------------------------------------------------------- /Images/gameshell_first_mission_small.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phyver/GameShell/d8e2f9a34f74ced097fb5e95be33682ae794c901/Images/gameshell_first_mission_small.gif -------------------------------------------------------------------------------- /Images/illustration-small.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phyver/GameShell/d8e2f9a34f74ced097fb5e95be33682ae794c901/Images/illustration-small.png -------------------------------------------------------------------------------- /Images/illustration.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phyver/GameShell/d8e2f9a34f74ced097fb5e95be33682ae794c901/Images/illustration.jpg -------------------------------------------------------------------------------- /doc/README.md: -------------------------------------------------------------------------------- 1 | [This](This) folder contains: 2 | - the [GameShell user manual](./user_manual.md), 3 | - the [GameShell developer manual](./dev_manual.md). 4 | -------------------------------------------------------------------------------- /doc/dev_manual.md: -------------------------------------------------------------------------------- 1 | [GameShell](GameShell) developer manual 2 | ========================== 3 | 4 | * [Mission creation manual](./mission.md) 5 | * [internationalisation / translation manual](./i18n.md) 6 | * [Record of mission ideas](./mission_ideas.md) 7 | 8 | 9 | Anything missing? 10 | Feel free to [open an issue](https://github.com/phyver/GameShell/issues/new). 11 | -------------------------------------------------------------------------------- /doc/user_manual.md: -------------------------------------------------------------------------------- 1 | GameShell installation and user manual 2 | ====================================== 3 | 4 | * [Installing dependencies on Linux, macOS and BSD](./deps.md) 5 | * [GameShell user manual and command descriptions](./gameshell.md) 6 | -------------------------------------------------------------------------------- /i18n/gameshell-help/en.txt: -------------------------------------------------------------------------------- 1 | Commands specific to GameShell 2 | ============================== 3 | 4 | gsh check 5 | check whether the current mission's goal has been 6 | achieved or not 7 | 8 | gsh exit / Control-d 9 | quit GameShell 10 | (you can start from the current mission by running 11 | GameShell with the "-C" flag) 12 | 13 | gsh goal [N] 14 | show the current mission's goal 15 | if n is given, show the goal for mission N 16 | 17 | gsh help 18 | shorter help message 19 | 20 | gsh reset 21 | reset the current mission 22 | -------------------------------------------------------------------------------- /i18n/gameshell-help/fr.txt: -------------------------------------------------------------------------------- 1 | Commandes propres à GameShell 2 | ============================= 3 | 4 | gsh check 5 | vérifie que l'objectif de la mission en cours 6 | est atteint 7 | 8 | gsh exit / Control-d 9 | quitte la partie en cours 10 | (vous pouvez recommencer à la mission courante en 11 | lançant GameShell avec l'option "-C") 12 | 13 | gsh goal [N] 14 | affiche l'objectif de la mission en cours 15 | si N est donné, affiche l'objectif de la mission N 16 | 17 | gsh help 18 | affiche ce message 19 | 20 | gsh reset 21 | ré-initialise la mission en cours 22 | -------------------------------------------------------------------------------- /i18n/gameshell-help/it.txt: -------------------------------------------------------------------------------- 1 | Comandi specifici di GameShell 2 | ============================== 3 | 4 | gsh check 5 | verifica se gli obiettivi della missione corrente 6 | sono stati raggiunti 7 | 8 | gsh exit / Control-d 9 | esci da GameShell 10 | (puoi partire dalla missione corrente eseguendo 11 | GameShell con il parametro "-C") 12 | 13 | gsh goal [N] 14 | mostra gli obiettivi della missione 15 | se N è fornito, mostra gli obiettivi della missione N 16 | 17 | gsh help 18 | messaggio di aiuto breve 19 | 20 | gsh reset 21 | reimposta la missione corrente 22 | -------------------------------------------------------------------------------- /i18n/gameshell-init-msg-short/en.txt: -------------------------------------------------------------------------------- 1 | Use the command 2 | $ gsh help 3 | to get the list of "gsh" commands. 4 | -------------------------------------------------------------------------------- /i18n/gameshell-init-msg-short/fr.txt: -------------------------------------------------------------------------------- 1 | Tapez la commande 2 | $ gsh help 3 | pour obtenir la liste des commandes "gsh". 4 | -------------------------------------------------------------------------------- /i18n/gameshell-init-msg-short/it.txt: -------------------------------------------------------------------------------- 1 | Usa il comando 2 | $ gsh help 3 | per ottenere una lista dei comandi "gsh". 4 | -------------------------------------------------------------------------------- /i18n/gameshell-init-msg/en.txt: -------------------------------------------------------------------------------- 1 | Run the command 2 | $ gsh goal 3 | to discover your first mission. 4 | 5 | You can check the mission has been completed with 6 | $ gsh check 7 | 8 | The command 9 | $ gsh help 10 | displays the list of available (gsh) commands. 11 | -------------------------------------------------------------------------------- /i18n/gameshell-init-msg/fr.txt: -------------------------------------------------------------------------------- 1 | Utilisez la commande 2 | $ gsh goal 3 | pour découvrir votre première mission. 4 | 5 | Vous pouvez vérifier si l'objectif est atteint avec 6 | $ gsh check 7 | 8 | La commande 9 | $ gsh help 10 | affiche la liste des commandes (gsh) disponibles. 11 | -------------------------------------------------------------------------------- /i18n/gameshell-init-msg/it.txt: -------------------------------------------------------------------------------- 1 | Esegui il comando 2 | $ gsh goal 3 | per scoprire la tua prima missione. 4 | 5 | Puoi verificare se la missione è stata completata con 6 | $ gsh check 7 | 8 | Il comando 9 | $ gsh help 10 | mostra la lista dei comandi (gsh) disponibili. 11 | -------------------------------------------------------------------------------- /i18n/start-help/en.txt: -------------------------------------------------------------------------------- 1 | usage: 2 | $GSH_EXEC_FILE [OPTIONS] [INDEX_FILE1 INDEX_FILE2 ...] 3 | 4 | Possible values for INDEX_FILE are: $GSH_INDEX_FILES. 5 | 6 | If no INDEX_FILE is given, defaults to default.idx. 7 | 8 | Index files are ignored when continuing from a save file. 9 | 10 | 11 | main options: 12 | -h this message 13 | -H show all available options 14 | -V display version 15 | -I show list of available index files 16 | 17 | -R reset game 18 | -F do not check for more recent savefiles, force using the given archive 19 | 20 | -L ... set LANGUAGE variable (ex: -L fr:it:en) 21 | On non GNU systems, set the variable LC_MESSAGES to a valid locale. 22 | This flag is ignored when continuing from a save file. 23 | 24 | -------------------------------------------------------------------------------- /lib/ascii-art/GameShell.txt: -------------------------------------------------------------------------------- 1 | ____ ____ _ _ _ 2 | / ___| __ _ _ __ ___ ___/ ___|| |__ ___| | | 3 | | | _ / _` | '_ ` _ \ / _ \___ \| '_ \ / _ \ | | 4 | | |_| | (_| | | | | | | __/___) | | | | __/ | | 5 | \____|\__,_|_| |_| |_|\___|____/|_| |_|\___|_|_| 6 | -------------------------------------------------------------------------------- /lib/ascii-art/titlescreen: -------------------------------------------------------------------------------- 1 | _ 2 | _/ \ 3 | _ / \ 4 | / \_ __ /\/\ /\ 5 | / \ / \ / \/ \ 6 | /\/\ /\ `--./.'- `-.\ 7 | / \/ ' ^ _ _ _ 8 | /\ ____.. YY Y _ |~ _ 9 | /._/ _ \_ Y Y [_]--'--[_] 10 | / / .'/#\_ `-. Y YY |'|""`""|'| 11 | .-_/#@##\ `\"" ' Y | | /^\ | | 12 | " "'"''"'"'''" ' |_|_|I|_|_| 13 | -------------------------------------------------------------------------------- /lib/ascii-art/treasure-chest.txt: -------------------------------------------------------------------------------- 1 | _.--. 2 | _.-'_:-'|| 3 | _.-'_.-::::'|| 4 | _.-:'_.-::::::' || 5 | .'`-.-:::::::' || 6 | /.'`;|:::::::' ||_ 7 | || ||::::::' _.;._'-._ 8 | || ||:::::' _.-!oo @.!-._'-. 9 | \'. ||:::::.-!()oo @!()@.-'_.| 10 | '.'-;|:.-'.&$@.& ()$%-'o.'\U|| 11 | `>'-.!@%()@'@_%-'_.-o _.|'|| 12 | jgs||-._'-.@.-'_.-' _.-o |'|| 13 | ||=[ '-._.-\U/.-' o |'|| 14 | || '-.]=|| |'| o |'|| 15 | || || |'| _| '; 16 | || || |'| _.-'_.-' 17 | |'-._ || |'|_.-'_.-' 18 | '-._'-.|| |' `_.-' 19 | '-.||_/.-' 20 | -------------------------------------------------------------------------------- /missions/FINAL_MISSION/check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | false 4 | -------------------------------------------------------------------------------- /missions/FINAL_MISSION/goal.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ADMIN_PASSWD=$(gettext "qwerty") 4 | 5 | ADMIN_SALT=$("$GSH_ROOT"/scripts/random_string) 6 | ADMIN_HASH=$(checksum "$ADMIN_SALT $ADMIN_PASSWD") 7 | 8 | echo "$ADMIN_SALT" > "$GSH_CONFIG/admin_salt" 9 | echo "$ADMIN_HASH" > "$GSH_CONFIG/admin_hash" 10 | 11 | sed "s/\\\$password/$ADMIN_PASSWD/g" "$(eval_gettext '$MISSION_DIR/goal/en.txt')" 12 | unset ADMIN_PASSWD ADMIN_SALT ADMIN_HASH 13 | -------------------------------------------------------------------------------- /missions/FINAL_MISSION/goal/en.txt: -------------------------------------------------------------------------------- 1 | 2 | Congratulations! 3 | 4 | You have finished all the missions. 5 | 6 | You can now quit GameShell, or go back to some old missions. 7 | 8 | Use ``gsh HELP`` to get a list of all GameShell commands. 9 | The commands ``gsh index`` and ``gsh goto N`` are particularly 10 | interesting. 11 | 12 | Note: the admin password has been changed to '$password'. 13 | 14 | -------------------------------------------------------------------------------- /missions/FINAL_MISSION/goal/fr.txt: -------------------------------------------------------------------------------- 1 | 2 | Bravo ! 3 | 4 | Vous avez terminé toutes les missions. 5 | 6 | Vous pouvez maintenant quitter GameShell ou retourner faire des 7 | missions déjà validées. 8 | 9 | Utilisez ``gsh HELP`` pour obtenir la liste de toutes les commandes 10 | GameShell. 11 | Les commandes ``gsh index`` et ``gsh goto N`` sont particulièrement 12 | intéressantes. 13 | 14 | Remarque : le mot de passe admin a été changé en '$password'. 15 | 16 | -------------------------------------------------------------------------------- /missions/FINAL_MISSION/goal/it.txt: -------------------------------------------------------------------------------- 1 | 2 | Congratulazioni! 3 | 4 | Hai finito tutte le missioni. 5 | 6 | Ora puoi chiudere GameShell o tornare a qualche precedente missione. 7 | 8 | Usa ``gsh HELP`` per una lista dei comandi di GameShell. 9 | Il comando ``gsh index`` e ``gsh goto N`` sono particolarmente 10 | interessanti. 11 | 12 | Nota: la password amministrativa è stata cambiata in '$password'. 13 | 14 | -------------------------------------------------------------------------------- /missions/FINAL_MISSION/i18n/template.pot: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 3 | "Content-Transfer-Encoding: 8bit\n" 4 | 5 | # path for the text file containing the goal 6 | #, sh-format 7 | msgid "$MISSION_DIR/goal/en.txt" 8 | msgstr "" 9 | 10 | #, sh-format 11 | msgid "$MISSION_DIR/msg/en.txt" 12 | msgstr "" 13 | 14 | # path for the text file containing the skip message 15 | msgid "$MISSION_DIR/skip/en.txt" 16 | msgstr "" 17 | 18 | # path for the text file containing the treasure message 19 | msgid "$MISSION_DIR/treasure-msg/en.txt" 20 | msgstr "" 21 | 22 | #, sh-format 23 | msgid "CONGRATULATION, you've finished the game!" 24 | msgstr "" 25 | 26 | msgid "qwerty" 27 | msgstr "" 28 | -------------------------------------------------------------------------------- /missions/FINAL_MISSION/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | if [ "$GSH_MODE" = DEBUG ] || [ -n "$GSH_QUIET_INTRO" ] 4 | then 5 | color_echo green "$(eval_gettext "CONGRATULATION, you've finished the game!")" 6 | echo 7 | gsh stat 8 | gsh exit 9 | else 10 | parchment -B Twinkle "$(eval_gettext '$MISSION_DIR/msg/en.txt')" 11 | fi 12 | -------------------------------------------------------------------------------- /missions/FINAL_MISSION/msg/en.txt: -------------------------------------------------------------------------------- 1 | 2 | CONGRATULATIONS! 3 | 4 | 5 | You have finished all the missions. 6 | 7 | -------------------------------------------------------------------------------- /missions/FINAL_MISSION/msg/fr.txt: -------------------------------------------------------------------------------- 1 | 2 | BRAVO ! 3 | 4 | Vous avez terminé toutes les missions. 5 | 6 | -------------------------------------------------------------------------------- /missions/FINAL_MISSION/msg/it.txt: -------------------------------------------------------------------------------- 1 | 2 | CONGRATULAZIONI! 3 | 4 | 5 | Hai finito tutte le missioni. 6 | 7 | -------------------------------------------------------------------------------- /missions/basic/01_cd_tower/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | cd "$(eval_gettext '$GSH_HOME/Castle/Main_tower/First_floor/Second_floor/Top_of_the_tower')" 4 | gsh check 5 | -------------------------------------------------------------------------------- /missions/basic/01_cd_tower/check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | goal=$(readlink-f "$(eval_gettext "\$GSH_HOME/Castle/Main_tower/First_floor/Second_floor/Top_of_the_tower")") 4 | current=$(readlink-f "$PWD") 5 | 6 | if [ "$goal" = "$current" ] 7 | then 8 | unset goal current 9 | true 10 | else 11 | echo "$(gettext "You are not at the top of the tower!")" 12 | echo "$(gettext "You need to start over from the start.")" 13 | cd "$GSH_HOME" 14 | unset goal current 15 | false 16 | fi 17 | -------------------------------------------------------------------------------- /missions/basic/01_cd_tower/i18n/template.pot: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 3 | "Content-Transfer-Encoding: 8bit\n" 4 | 5 | #, sh-format 6 | msgid "$GSH_HOME/Castle/Main_tower/First_floor/Second_floor/Top_of_the_tower" 7 | msgstr "" 8 | 9 | # path for the text file containing the goal 10 | msgid "$MISSION_DIR/goal/en.txt" 11 | msgstr "" 12 | 13 | # path for the text file containing the skip message 14 | msgid "$MISSION_DIR/skip/en.txt" 15 | msgstr "" 16 | 17 | # path for the text file containing the treasure message 18 | msgid "$MISSION_DIR/treasure-msg/en.txt" 19 | msgstr "" 20 | 21 | msgid "You are not at the top of the tower!" 22 | msgstr "" 23 | 24 | msgid "You need to start over from the start." 25 | msgstr "" 26 | -------------------------------------------------------------------------------- /missions/basic/01_cd_tower/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | cd "$GSH_HOME" 4 | -------------------------------------------------------------------------------- /missions/basic/01_cd_tower/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | mkdir -p "$(eval_gettext "\$GSH_HOME/Castle/Main_tower/First_floor/Second_floor/Top_of_the_tower")" 3 | -------------------------------------------------------------------------------- /missions/basic/01_cd_tower/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | gsh assert_check false 4 | 5 | cd .. 6 | gsh assert_check false 7 | 8 | cd 9 | gsh assert_check false 10 | 11 | cd "$(eval_gettext "\$GSH_HOME/Castle/Main_tower/First_floor/Second_floor/Top_of_the_tower")" 12 | gsh assert_check true 13 | 14 | cd "$(eval_gettext "\$GSH_HOME/Castle/Main_tower/First_floor/Second_floor/Top_of_the_tower")/.." 15 | gsh assert_check false 16 | -------------------------------------------------------------------------------- /missions/basic/02_cd.._cellar/ascii-art/apple.txt: -------------------------------------------------------------------------------- 1 | 2 | ,--./,-. 3 | / # \ 4 | | | 5 | \ / 6 | `._,._,' hjw 7 | 8 | -------------------------------------------------------------------------------- /missions/basic/02_cd.._cellar/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | cd "$(eval_gettext "\$GSH_HOME/Castle/Cellar")" 4 | gsh check 5 | -------------------------------------------------------------------------------- /missions/basic/02_cd.._cellar/check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | goal=$(readlink-f "$(eval_gettext "\$GSH_HOME/Castle/Cellar")") 4 | current=$(readlink-f "$PWD") 5 | 6 | if [ "$goal" = "$current" ] 7 | then 8 | unset goal current 9 | true 10 | else 11 | echo "$(gettext "You are not in the cellar...")" 12 | unset goal current 13 | false 14 | fi 15 | -------------------------------------------------------------------------------- /missions/basic/02_cd.._cellar/goal/en.txt: -------------------------------------------------------------------------------- 1 | Mission goal 2 | ============ 3 | 4 | Go the castle's cellar. 5 | 6 | 7 | Secondary objective 8 | ------------------- 9 | 10 | Understand the difference between ``cd -`` and ``cd ..``. 11 | 12 | 13 | Useful commands 14 | =============== 15 | 16 | cd - 17 | Jump back to the location you were in prior to your last move. 18 | 19 | cd .. 20 | Move to the parent directory (one step back along the path to your 21 | current location). 22 | 23 | pwd 24 | See the path to your current location. 25 | 26 | -------------------------------------------------------------------------------- /missions/basic/02_cd.._cellar/goal/fr.txt: -------------------------------------------------------------------------------- 1 | Objectif 2 | ======== 3 | 4 | Allez dans la cave du château. 5 | 6 | 7 | Objectif secondaire 8 | ------------------- 9 | 10 | Apprenez à faire la différence entre ``cd -`` et ``cd ..``. 11 | 12 | 13 | Commandes utiles 14 | ================ 15 | 16 | cd - 17 | Retourne dans le lieu précédent. 18 | 19 | cd .. 20 | Se déplace dans le répertoire parent (le lieu qui se trouve 21 | "avant" le lieu actuel dans la liste donnée par ``pwd``). 22 | 23 | pwd 24 | Affiche la position actuelle. 25 | -------------------------------------------------------------------------------- /missions/basic/02_cd.._cellar/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivi Missione 2 | ============ 3 | 4 | Vai nella cantina del castello. 5 | 6 | 7 | Obiettivo secondario 8 | ------------------- 9 | 10 | Scoprire le differenze tra ``cd -`` e ``cd ..``. 11 | 12 | 13 | Comandi utili 14 | =============== 15 | 16 | cd - 17 | Torna alla (cartella) posizione precedente alla attuale. 18 | 19 | cd .. 20 | Spostati alla cartella genitore (un passo indietro rispetto 21 | alla tua posizione attuale). 22 | 23 | pwd 24 | Mostra il percorso in cui ti trovi. 25 | 26 | -------------------------------------------------------------------------------- /missions/basic/02_cd.._cellar/i18n/template.pot: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 3 | "Content-Transfer-Encoding: 8bit\n" 4 | 5 | #, sh-format 6 | msgid "$GSH_HOME/Castle/Cellar" 7 | msgstr "" 8 | 9 | # path for the text file containing the goal 10 | msgid "$MISSION_DIR/goal/en.txt" 11 | msgstr "" 12 | 13 | # path for the text file containing the skip message 14 | msgid "$MISSION_DIR/skip/en.txt" 15 | msgstr "" 16 | 17 | # path for the text file containing the treasure message 18 | msgid "$MISSION_DIR/treasure-msg/en.txt" 19 | msgstr "" 20 | 21 | msgid "You are not in the cellar..." 22 | msgstr "" 23 | 24 | msgid "barrel_of_apples" 25 | msgstr "" 26 | -------------------------------------------------------------------------------- /missions/basic/02_cd.._cellar/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext '$GSH_HOME/Castle/Cellar')" 4 | sign_file "$MISSION_DIR/ascii-art/apple.txt" "$(eval_gettext '$GSH_HOME/Castle/Cellar')/$(gettext "barrel_of_apples")" 5 | -------------------------------------------------------------------------------- /missions/basic/02_cd.._cellar/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | cd 4 | gsh assert_check false 5 | 6 | cd "$(eval_gettext "\$GSH_HOME/Castle/Cellar")" 7 | gsh assert_check true 8 | 9 | cd "$(eval_gettext "\$GSH_HOME/Castle/Cellar")/.." 10 | gsh assert_check false 11 | 12 | cd 13 | gsh assert_check false 14 | 15 | 16 | -------------------------------------------------------------------------------- /missions/basic/03_cd_HOME_throne/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | . alt_history_start.sh 4 | 5 | cd "$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room')" 6 | 7 | # commands from a sourced file aren't saved in the history, 8 | # we need to do that explicitly 9 | add_cmd cd 10 | add_cmd cd "$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room')" 11 | add_cmd gsh check 12 | gsh check 13 | 14 | . alt_history_stop.sh 15 | -------------------------------------------------------------------------------- /missions/basic/03_cd_HOME_throne/check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # this should be POSIX compliant, but debian's sh (dash) doesn't have fc! 4 | 5 | _mission_check() { 6 | goal=$(readlink-f "$(eval_gettext "\$GSH_HOME/Castle/Main_building/Throne_room")") 7 | current=$(readlink-f "$PWD") 8 | 9 | ppc=$(. fc-lnr.sh | grep -v '^[[:blank:]]*gsh' | sed -n '2p;3q') 10 | 11 | # FIXME: also accept other commands to go back to the starting point? 12 | # FIXME: add an error message 13 | [ "$goal" = "$current" ] && [ "$ppc" = "cd" ] 14 | } 15 | 16 | _mission_check 17 | -------------------------------------------------------------------------------- /missions/basic/03_cd_HOME_throne/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivi Missione 2 | ============ 3 | 4 | Devi tornare alla posizione iniziale e andare alla stanza del trono 5 | utilizzando solo due comandi. 6 | 7 | Note 8 | ------ 9 | 10 | Puoi sperimentare con quanti comandi vuoi ma devi validare la missione 11 | alle seguenti condizioni: 12 | - il primo comando deve portarti al punto iniziale, 13 | - l'ultimo commando deve portarti direttamente alla stanza del trono. 14 | 15 | 16 | Comandi utili 17 | =============== 18 | 19 | cd 20 | Torna indietro alla posizione iniziale. 21 | 22 | cd POSIZIONE1/POSIZIONE2/POSIZIONE3 23 | Fa diversi spostamenti con un comando. 24 | 25 | 26 | Note 27 | ------ 28 | 29 | Le parole in MAIUSCOLO nei comandi sono meta-variabili: devi 30 | sostituirle con dei valori (di tipo stringa). 31 | -------------------------------------------------------------------------------- /missions/basic/03_cd_HOME_throne/i18n/en.po: -------------------------------------------------------------------------------- 1 | # AUTOMATICALLY GENERATED -- DO NOT EDIT 2 | msgid "" 3 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 4 | "Content-Transfer-Encoding: 8bit\n" 5 | 6 | #, sh-format 7 | msgid "$GSH_HOME/Castle/Main_building/Throne_room" 8 | msgstr "$GSH_HOME/Castle/Main_building/Throne_room" 9 | 10 | # path for the text file containing the goal 11 | msgid "$MISSION_DIR/goal/en.txt" 12 | msgstr "$MISSION_DIR/goal/en.txt" 13 | 14 | # path for the text file containing the skip message 15 | msgid "$MISSION_DIR/skip/en.txt" 16 | msgstr "$MISSION_DIR/skip/en.txt" 17 | 18 | # path for the text file containing the treasure message 19 | msgid "$MISSION_DIR/treasure-msg/en.txt" 20 | msgstr "$MISSION_DIR/treasure-msg/en.txt" 21 | -------------------------------------------------------------------------------- /missions/basic/03_cd_HOME_throne/i18n/fr.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 3 | "Content-Transfer-Encoding: 8bit\n" 4 | 5 | #, sh-format 6 | msgid "$GSH_HOME/Castle/Main_building/Throne_room" 7 | msgstr "$GSH_HOME/Chateau/Batiment_principal/Salle_du_trone" 8 | 9 | # path for the text file containing the goal 10 | msgid "$MISSION_DIR/goal/en.txt" 11 | msgstr "$MISSION_DIR/goal/fr.txt" 12 | 13 | # path for the text file containing the skip message 14 | msgid "$MISSION_DIR/skip/en.txt" 15 | msgstr "$MISSION_DIR/skip/fr.txt" 16 | 17 | # path for the text file containing the treasure message 18 | msgid "$MISSION_DIR/treasure-msg/en.txt" 19 | msgstr "$MISSION_DIR/treasure-msg/fr.txt" 20 | -------------------------------------------------------------------------------- /missions/basic/03_cd_HOME_throne/i18n/template.pot: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 3 | "Content-Transfer-Encoding: 8bit\n" 4 | 5 | #, sh-format 6 | msgid "$GSH_HOME/Castle/Main_building/Throne_room" 7 | msgstr "" 8 | 9 | # path for the text file containing the goal 10 | msgid "$MISSION_DIR/goal/en.txt" 11 | msgstr "" 12 | 13 | # path for the text file containing the skip message 14 | msgid "$MISSION_DIR/skip/en.txt" 15 | msgstr "" 16 | 17 | # path for the text file containing the treasure message 18 | msgid "$MISSION_DIR/treasure-msg/en.txt" 19 | msgstr "" 20 | -------------------------------------------------------------------------------- /missions/basic/03_cd_HOME_throne/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room')" 4 | -------------------------------------------------------------------------------- /missions/basic/03_cd_HOME_throne/treasure-msg/en.txt: -------------------------------------------------------------------------------- 1 | Well done!!! 2 | 3 | From now on, the current location will be 4 | shown just before the command prompt. 5 | -------------------------------------------------------------------------------- /missions/basic/03_cd_HOME_throne/treasure-msg/fr.txt: -------------------------------------------------------------------------------- 1 | Bravo !!! 2 | 3 | À partir de maintenant, le lieu actuel sera 4 | affiché juste avant l'invite de commande. 5 | -------------------------------------------------------------------------------- /missions/basic/03_cd_HOME_throne/treasure-msg/it.txt: -------------------------------------------------------------------------------- 1 | Ottimo lavoro!!! 2 | 3 | Da ora in poi, la posizione corrente 4 | sará mostrata appena prima del prompt comandi 5 | -------------------------------------------------------------------------------- /missions/basic/03_cd_HOME_throne/treasure.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | case "$GSH_SHELL" in 4 | *bash) 5 | export PS1=' 6 | \w 7 | [mission $(gsh pcm)] $ ' 8 | ;; 9 | *zsh) 10 | export PS1=' 11 | %~ 12 | [mission $(gsh pcm)] $ ' 13 | ;; 14 | esac 15 | -------------------------------------------------------------------------------- /missions/basic/04_mkdir_chest/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext "\$GSH_HOME/Forest")/$(gettext "Hut")/$(gettext "Chest")" 4 | gsh check 5 | -------------------------------------------------------------------------------- /missions/basic/04_mkdir_chest/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | case $GSH_LAST_ACTION in 4 | check_true) 5 | : 6 | ;; 7 | *) 8 | case "$(pwd -P)" in 9 | "$GSH_HOME"/*) 10 | if echo "${PWD#$GSH_HOME/}" | grep -Eq "$(gettext "Hut")|$(gettext "Chest")" 11 | then 12 | cd "$GSH_HOME" 13 | echo "$(gettext "You are back at the initial directory.")" 14 | fi 15 | ;; 16 | esac 17 | find "$GSH_HOME" -iname "$(gettext "Hut")" -print0 | xargs -0 rm -rf 18 | find "$GSH_HOME" -iname "$(gettext "Chest")" -print0 | xargs -0 rm -rf 19 | ;; 20 | esac 21 | 22 | -------------------------------------------------------------------------------- /missions/basic/04_mkdir_chest/goal/en.txt: -------------------------------------------------------------------------------- 1 | Mission goal 2 | ============ 3 | 4 | Build a "Hut" in the forest, and then build a "Chest" in the 5 | hut. 6 | 7 | 8 | Useful commands 9 | =============== 10 | 11 | mkdir DIRECTORY 12 | Create a new directory inside the current directory. 13 | Remark: ``mkdir`` is an abbreviation for "make directory". 14 | -------------------------------------------------------------------------------- /missions/basic/04_mkdir_chest/goal/fr.txt: -------------------------------------------------------------------------------- 1 | Objectif 2 | ======== 3 | 4 | Construisez une "Hutte" dans la forêt, et un "Coffre" dans la 5 | hutte. 6 | 7 | 8 | Commandes utiles 9 | =================== 10 | 11 | mkdir REPERTOIRE 12 | Crée un nouveau répertoire dans le répertoire courant. 13 | Note : ``mkdir`` est une abréviation pour "make directory". 14 | 15 | 16 | Remarque 17 | -------- 18 | 19 | Les termes apparaissant en MAJUSCULES dans les commandes sont des 20 | méta-variables : vous devez les remplacer par des valeurs (chaines 21 | de caractères) appropriées. 22 | -------------------------------------------------------------------------------- /missions/basic/04_mkdir_chest/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivi Missione 2 | ============ 3 | 4 | Costruisci una "Capanna" nella foresta e anche una "Cassa" 5 | nella capanna. 6 | 7 | 8 | Comandi utili 9 | =============== 10 | 11 | mkdir CARTELLA 12 | Crea una nuova cartella dentro la cartella attuale. 13 | Nota: ``mkdir`` è una abbreviazione per "make directory". 14 | -------------------------------------------------------------------------------- /missions/basic/04_mkdir_chest/gshrc: -------------------------------------------------------------------------------- 1 | export GSH_CHEST="$(eval_gettext '$GSH_HOME/Forest')/$(gettext "Hut")/$(gettext "Chest")" 2 | -------------------------------------------------------------------------------- /missions/basic/04_mkdir_chest/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext "\$GSH_HOME/Forest")" 4 | -------------------------------------------------------------------------------- /missions/basic/05_rm_spiders_cellar/ascii-art/bat-0.txt: -------------------------------------------------------------------------------- 1 | 2 | /\ /\ 3 | / \'._ (\_/) _.'/ \ 4 | /_.''._'--('.')--'_.''._\ 5 | | \_ / `;=/ " \=;` \ _/ | 6 | \/ `\__|`\___/`|__/` \/ 7 | ` \(/|\)/ ` 8 | " ` " jgs 9 | 10 | -------------------------------------------------------------------------------- /missions/basic/05_rm_spiders_cellar/ascii-art/bat-1.txt: -------------------------------------------------------------------------------- 1 | 2 | /\ /\ 3 | / \'._ (\_/) _.'/ \ 4 | |.''._'--(o.o)--'_.''.| 5 | \_ / `;=/ " \=;` \ _/ 6 | `\__| \___/ |__/` 7 | \(_|_)/ jgs 8 | 9 | -------------------------------------------------------------------------------- /missions/basic/05_rm_spiders_cellar/ascii-art/bat-2.txt: -------------------------------------------------------------------------------- 1 | 2 | =/\ /\= 3 | / \'._ (\_/) _.'/ \ 4 | / .''._'--(o.o)--'_.''. \ 5 | /.' _/ |`'=/ " \='`| \_ `.\ 6 | /` .' `\;-,'\___/',-;/` '. '\ 7 | /.-' `\(-V-)/` `-.\ 8 | ` " " jgs ` 9 | 10 | -------------------------------------------------------------------------------- /missions/basic/05_rm_spiders_cellar/ascii-art/spider-0.txt: -------------------------------------------------------------------------------- 1 | 2 | _\(_)/_ 3 | /(o)\ jgs 4 | 5 | -------------------------------------------------------------------------------- /missions/basic/05_rm_spiders_cellar/ascii-art/spider-1.txt: -------------------------------------------------------------------------------- 1 | __ 2 | | / \ | 3 | \_\\ //_/ 4 | //()\\ 5 | \\ // jgs 6 | 7 | -------------------------------------------------------------------------------- /missions/basic/05_rm_spiders_cellar/ascii-art/spider-2.txt: -------------------------------------------------------------------------------- 1 | _.._ 2 | .' '. 3 | / __ \ 4 | , | >< | , 5 | . \ \ / / . 6 | \_'--`( )'--'_/ 7 | .--'/()\'--. 8 | / /` '' `\ \ 9 | | | 10 | \ / jgs 11 | 12 | -------------------------------------------------------------------------------- /missions/basic/05_rm_spiders_cellar/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | rm "$(eval_gettext '$GSH_HOME/Castle/Cellar')/$(gettext "spider")"_? 4 | gsh check 5 | -------------------------------------------------------------------------------- /missions/basic/05_rm_spiders_cellar/check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_check() ( 4 | cellar="$(eval_gettext '$GSH_HOME/Castle/Cellar')" 5 | 6 | # Check that there are no more spiders. 7 | spiders=$(find "$cellar" -name "$(gettext "spider")_*") 8 | if [ -n "$spiders" ] 9 | then 10 | echo "$(gettext "There still are spiders in the cellar!")" 11 | return 1 12 | fi 13 | 14 | # Check that the bats are still there. 15 | bats_nb=$(find "$cellar" -name "$(gettext "bat")_*" | wc -l) 16 | if [ "$bats_nb" -ne 2 ] 17 | then 18 | echo "$(gettext "You removed a bat!")" 19 | return 1 20 | fi 21 | 22 | return 0 23 | ) 24 | 25 | _mission_check 26 | -------------------------------------------------------------------------------- /missions/basic/05_rm_spiders_cellar/goal/en.txt: -------------------------------------------------------------------------------- 1 | Mission goal 2 | ============ 3 | 4 | Go back to the cellar and get rid of all the spiders. Leave the bats 5 | alone: they appear on the castle's coat of arms and are said to 6 | confer luck. 7 | 8 | 9 | Useful commands 10 | =============== 11 | 12 | rm FILE1 FILE2 ... FILEn 13 | Delete the files (permanently). 14 | Remark: ``rm`` is an abbreviation for "remove". 15 | -------------------------------------------------------------------------------- /missions/basic/05_rm_spiders_cellar/goal/fr.txt: -------------------------------------------------------------------------------- 1 | Objectif 2 | ======== 3 | 4 | Retournez dans la cave, et supprimez les araignées qui s'y trouvent. 5 | Laissez les chauves-souris tranquilles : elles apparaissent sur le 6 | blason du chateau et on dit qu'elles portent chance. 7 | 8 | 9 | Commandes utiles 10 | ================ 11 | 12 | rm FICHIER1 FICHIER2 ... FICHIERn 13 | Supprime (définitivement) les fichiers. 14 | Note : ``rm`` est une abréviation pour "remove". 15 | -------------------------------------------------------------------------------- /missions/basic/05_rm_spiders_cellar/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivi Missione 2 | ============ 3 | 4 | Torna indietro alla cantina e elimina tutti i ragni. Lascia i 5 | pipistrelli da soli: loro appaiono nel castello sullo stemma del 6 | castello e si dice che portino fortuna. 7 | 8 | 9 | Comandi utili 10 | =============== 11 | 12 | rm FILE1 FILE2 ... FILEn 13 | Elimina i file (permanentemente). 14 | Nota: ``rm`` è una abbreviazione per "remove". 15 | -------------------------------------------------------------------------------- /missions/basic/05_rm_spiders_cellar/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_init() ( 4 | for i in $(seq 3) 5 | do 6 | spider=$(eval_gettext '$GSH_HOME/Castle/Cellar')/$(gettext "spider")_$i 7 | sign_file "$MISSION_DIR/ascii-art/spider-$(($(RANDOM)%3)).txt" "$spider" 8 | done 9 | 10 | for i in $(seq 2) 11 | do 12 | bat=$(eval_gettext '$GSH_HOME/Castle/Cellar')/$(gettext "bat")_$i 13 | sign_file "$MISSION_DIR/ascii-art/bat-$(($(RANDOM)%3)).txt" "$bat" 14 | done 15 | ) 16 | 17 | _mission_init 18 | -------------------------------------------------------------------------------- /missions/basic/05_rm_spiders_cellar/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext "\$GSH_HOME/Castle/Cellar")" 4 | -------------------------------------------------------------------------------- /missions/basic/05_rm_spiders_cellar/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | gsh assert check false 4 | 5 | rm "$(eval_gettext '$GSH_HOME/Castle/Cellar')"/* 6 | gsh assert check false 7 | 8 | rm "$(eval_gettext '$GSH_HOME/Castle/Cellar')/$(gettext "spider")"_? 9 | gsh assert check true 10 | 11 | rm "$(eval_gettext '$GSH_HOME/Castle/Cellar')/$(gettext "spider")"_? 12 | rm "$(eval_gettext '$GSH_HOME/Castle/Cellar')/$(gettext "bat")"_1 13 | gsh assert check false 14 | -------------------------------------------------------------------------------- /missions/basic/06_mv_coins_garden/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mv "$(eval_gettext '$GSH_HOME/Garden')/$(gettext "coin")_"? "$GSH_CHEST" 4 | gsh check 5 | -------------------------------------------------------------------------------- /missions/basic/06_mv_coins_garden/goal/en.txt: -------------------------------------------------------------------------------- 1 | Mission goal 2 | ============ 3 | 4 | Collect all the coins that you can find in the garden in front of 5 | the castle, and put them in your chest in your hut in the forest. 6 | 7 | 8 | Useful commands 9 | =============== 10 | 11 | mv FILE1 FILE2 ... FILEn DIRECTORY 12 | Move the files to the directory. 13 | Remark: ``mv`` is an abbreviation of "move". 14 | 15 | ~ 16 | The "~" symbol is an abbreviation for the initial directory. 17 | Example: wherever you are, ``~/Tavern`` denotes the directory (or 18 | file) "Tavern" in the initial directory. 19 | -------------------------------------------------------------------------------- /missions/basic/06_mv_coins_garden/goal/fr.txt: -------------------------------------------------------------------------------- 1 | Objectif 2 | ======== 3 | 4 | Ramassez toutes les pièces qui se trouvent dans le jardin en face du 5 | château et placez les dans votre coffre (dans votre hutte, dans la 6 | forêt). 7 | 8 | 9 | Commandes utiles 10 | ================ 11 | 12 | mv FICHIER1 FICHIER2 ... FICHIERn REPERTOIRE 13 | Déplace les fichiers vers le répertoire. 14 | Note : ``mv`` est une abréviation pour "move". 15 | 16 | ~ 17 | Le symbole "~" est une abréviation pour le répertoire initial. 18 | Par exemple, où que vous soyez, ``~/Taverne`` représente le 19 | répertoire (ou fichier) "Taverne" dans le répertoire initial. 20 | -------------------------------------------------------------------------------- /missions/basic/06_mv_coins_garden/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivi Missione 2 | ============ 3 | 4 | Colleziona tutte le monete che troverai nel giardino di fronte al 5 | castello, poi mettile nella cassa dentro la tua capanna nella foresta. 6 | 7 | 8 | Comandi utili 9 | =============== 10 | 11 | mv FILE1 FILE2 ... FILEn DIRECTORY 12 | Sposta i file nella cartella. 13 | Nota: ``mv`` e una abbreviazione di "move". 14 | 15 | ~ 16 | Il "~" simbolo é una abbreviazione per la cartella iniziale. 17 | Esempio: ovunque tu sia, ``~/Taverna`` indica la cartella (o 18 | file) "Taverna" nella cartella iniziale. 19 | -------------------------------------------------------------------------------- /missions/basic/06_mv_coins_garden/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | [ -z "$GSH_CHEST" ] && GSH_CHEST="$(eval_gettext '$GSH_HOME/Forest/Hut/Chest')" 4 | mkdir -p "$GSH_CHEST" 5 | 6 | _mission_init() ( 7 | for i in $(seq 3) 8 | do 9 | C="$(gettext "coin")_$i" 10 | touch "$(eval_gettext "\$GSH_HOME/Garden")/$C" 11 | sign_file "$(eval_gettext "\$GSH_HOME/Garden")/$C" 12 | done 13 | ) 14 | 15 | _mission_init 16 | -------------------------------------------------------------------------------- /missions/basic/06_mv_coins_garden/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext "\$GSH_HOME/Garden")" 4 | -------------------------------------------------------------------------------- /missions/basic/06_mv_coins_garden/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mv "$(eval_gettext '$GSH_HOME/Garden')/$(gettext "coin")_"2 "$GSH_CHEST" 4 | gsh assert check false 5 | 6 | mv "$(eval_gettext '$GSH_HOME/Garden')/$(gettext "coin")_1" \ 7 | "$(eval_gettext '$GSH_HOME/Garden')/$(gettext "coin")_3" "$GSH_CHEST" 8 | gsh assert check false 9 | 10 | mv "$(eval_gettext '$GSH_HOME/Garden')/$(gettext "coin")_"? "$GSH_CHEST" 11 | gsh assert check true 12 | -------------------------------------------------------------------------------- /missions/basic/07_mv_hidden_coins_garden/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mv "$(eval_gettext '$GSH_HOME/Garden')/".*_"$(gettext "coin")"_* "$GSH_CHEST" 4 | gsh check 5 | -------------------------------------------------------------------------------- /missions/basic/07_mv_hidden_coins_garden/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | case "$GSH_LAST_ACTION" in 4 | "check_true") 5 | ;; 6 | *) 7 | find "$GSH_HOME" -name ".*_$(gettext "coin")_*" -type f -print0 | xargs -0 rm -f 8 | find "$(eval_gettext '$GSH_HOME/Garden')" -iname "*$(gettext "chest")*" -type f -print0 | xargs -0 rm -f 9 | find "$(eval_gettext '$GSH_HOME/Garden')" -iname "*$(gettext "hut")*" -type f -print0 | xargs -0 rm -f 10 | ;; 11 | esac 12 | -------------------------------------------------------------------------------- /missions/basic/07_mv_hidden_coins_garden/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | [ -z "$GSH_CHEST" ] && GSH_CHEST="$(eval_gettext '$GSH_HOME/Forest/Hut/Chest')" 4 | mkdir -p "$GSH_CHEST" 5 | 6 | _mission_init() ( 7 | rm -f "$(eval_gettext '$GSH_HOME/Garden')/.$(gettext "coin")_"* 8 | 9 | for i in $(seq 3) 10 | do 11 | f=$(eval_gettext '$GSH_HOME/Garden')/.$(RANDOM)_$(gettext "coin")_$i 12 | touch "$f" 13 | sign_file "$f" 14 | done 15 | ) 16 | 17 | _mission_init 18 | -------------------------------------------------------------------------------- /missions/basic/07_mv_hidden_coins_garden/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext "\$GSH_HOME/Garden")" 4 | -------------------------------------------------------------------------------- /missions/basic/08_rm_wildcard_spiders_cellar/ascii-art: -------------------------------------------------------------------------------- 1 | ../05_rm_spiders_cellar/ascii-art -------------------------------------------------------------------------------- /missions/basic/08_rm_wildcard_spiders_cellar/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | rm -f "$(eval_gettext '$GSH_HOME/Castle/Cellar')/"*_"$(gettext "spider")"_* 4 | gsh check 5 | -------------------------------------------------------------------------------- /missions/basic/08_rm_wildcard_spiders_cellar/check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_check() ( 4 | CELLAR="$(eval_gettext "\$GSH_HOME/Castle/Cellar")" 5 | 6 | nb_spiders=$(find "$CELLAR" -maxdepth 1 -name "*_$(gettext "spider")_*" | wc -l | tr -d ' ') 7 | if [ "$nb_spiders" -ne 0 ] 8 | then 9 | echo "$(eval_gettext "There still are some spiders (\$nb_spiders) in the cellar!")" 10 | return 1 11 | fi 12 | 13 | S1=$(find "$CELLAR" -maxdepth 1 -name "*_$(gettext "bat")_*" | sort | checksum) 14 | S2=$(cat "$GSH_TMP/bats") 15 | 16 | if [ "$S1" != "$S2" ] 17 | then 18 | echo "$(eval_gettext "Some bats have been modified!")" 19 | return 1 20 | fi 21 | return 0 22 | ) 23 | 24 | _mission_check 25 | -------------------------------------------------------------------------------- /missions/basic/08_rm_wildcard_spiders_cellar/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | rm -f "$GSH_TMP/bats" 4 | -------------------------------------------------------------------------------- /missions/basic/08_rm_wildcard_spiders_cellar/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext "\$GSH_HOME/Castle/Cellar")" 4 | -------------------------------------------------------------------------------- /missions/basic/08_rm_wildcard_spiders_cellar/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | gsh assert check false 4 | 5 | rm -f "$(eval_gettext '$GSH_HOME/Castle/Cellar')"/??* 6 | gsh assert check false 7 | 8 | rm -f "$(eval_gettext '$GSH_HOME/Castle/Cellar')"/*_"$(gettext "spider")"_* 9 | gsh assert check true 10 | 11 | -------------------------------------------------------------------------------- /missions/basic/09_rm_wildcard_hidden_spiders_cellar/ascii-art: -------------------------------------------------------------------------------- 1 | ../05_rm_spiders_cellar/ascii-art -------------------------------------------------------------------------------- /missions/basic/09_rm_wildcard_hidden_spiders_cellar/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | rm -f "$(eval_gettext '$GSH_HOME/Castle/Cellar')/".*_"$(gettext "spider")"_* 4 | gsh check 5 | -------------------------------------------------------------------------------- /missions/basic/09_rm_wildcard_hidden_spiders_cellar/check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_check() ( 4 | CELLAR="$(eval_gettext "\$GSH_HOME/Castle/Cellar")" 5 | 6 | nb_spiders=$(find "$CELLAR" -maxdepth 1 -name "*_$(gettext "spider")_*" | wc -l | tr -d ' ') 7 | if [ "$nb_spiders" -ne 0 ] 8 | then 9 | echo "$(eval_gettext "There still are some spiders (\$nb_spiders) in the cellar!")" 10 | return 1 11 | fi 12 | 13 | S1=$(find "$CELLAR" -maxdepth 1 -name "*_$(gettext "bat")_*" | sort | checksum) 14 | S2=$(cat "$GSH_TMP/bats") 15 | 16 | if [ "$S1" != "$S2" ] 17 | then 18 | echo "$(eval_gettext "Some bats have been modified!")" 19 | return 1 20 | fi 21 | return 0 22 | ) 23 | 24 | _mission_check 25 | -------------------------------------------------------------------------------- /missions/basic/09_rm_wildcard_hidden_spiders_cellar/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | rm -f "$GSH_TMP/bats" 4 | 5 | -------------------------------------------------------------------------------- /missions/basic/09_rm_wildcard_hidden_spiders_cellar/goal/en.txt: -------------------------------------------------------------------------------- 1 | Mission goal 2 | ============ 3 | 4 | The spiders are getting clever: they found a way to hide. 5 | Get rid of all the spiders that are hiding in the cellar without 6 | disturbing the bats. 7 | 8 | 9 | Shell patterns 10 | ============== 11 | 12 | * 13 | The "*" character stands in for any sequence of characters 14 | (including an empty sequence). 15 | 16 | ? 17 | The "?" character stands in for any single character. 18 | 19 | 20 | Remark 21 | ------ 22 | 23 | The wildcards "*" and "?" don't see hidden files, you need to add an 24 | explicit dot at the start of the pattern. 25 | -------------------------------------------------------------------------------- /missions/basic/09_rm_wildcard_hidden_spiders_cellar/goal/fr.txt: -------------------------------------------------------------------------------- 1 | Objectif 2 | ======== 3 | 4 | Les araignées deviennent plus intelligentes : elles ont appris à se 5 | cacher. 6 | Supprimez toutes les araignées qui se cachent dans la cave, sans 7 | toucher les chauve-souris. 8 | 9 | 10 | Motifs shell 11 | ============ 12 | 13 | * 14 | Le caractère "*" est un joker pour n'importe quelle chaine de 15 | caractères (y compris la chaine vide). 16 | 17 | ? 18 | Le caractère "?" est un joker pour n'importe caractère. 19 | 20 | 21 | Remarque 22 | -------- 23 | 24 | Les jokers "*" et "?" ne voient pas les fichiers cachés, il faut 25 | ajouter un point explicite au début du motif. 26 | -------------------------------------------------------------------------------- /missions/basic/09_rm_wildcard_hidden_spiders_cellar/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivi Missione 2 | ============ 3 | 4 | I ragni si fanno più furbi: hanno trovato un modo per nascondersi. 5 | Rimuovi tutti i ragni che si nascondono nella cantina senza 6 | disturbare i pipistrelli. 7 | 8 | 9 | Parametri Shell 10 | ============== 11 | 12 | * 13 | Il carattere "*" sta per ogni sequenza di caratteri 14 | (inclusa una frase vuota). 15 | 16 | ? 17 | Il carattere "?" sta per un qualunque singolo carattere. 18 | 19 | 20 | Note 21 | ------ 22 | 23 | Le "wildcard" "*" e "?" non vedono i file nascosti, devi aggiungere 24 | un punto all'inizio dello schema. 25 | -------------------------------------------------------------------------------- /missions/basic/09_rm_wildcard_hidden_spiders_cellar/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext "\$GSH_HOME/Castle/Cellar")" 4 | -------------------------------------------------------------------------------- /missions/basic/09_rm_wildcard_hidden_spiders_cellar/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | gsh assert check false 4 | 5 | rm -f "$(eval_gettext '$GSH_HOME/Castle/Cellar')"/.??* 6 | gsh assert check false 7 | 8 | rm -f "$(eval_gettext '$GSH_HOME/Castle/Cellar')"/.*_"$(gettext "spider")"_* 9 | gsh assert check true 10 | 11 | -------------------------------------------------------------------------------- /missions/basic/09_rm_wildcard_hidden_spiders_cellar/treasure-msg/en.txt: -------------------------------------------------------------------------------- 1 | Congratulations ! 2 | 3 | From now on, the ``ls`` command will 4 | automatically show a "/" character at the end 5 | of directories. 6 | -------------------------------------------------------------------------------- /missions/basic/09_rm_wildcard_hidden_spiders_cellar/treasure-msg/fr.txt: -------------------------------------------------------------------------------- 1 | Bravo ! 2 | 3 | À partir de maintenant, la commande ``ls`` 4 | affichera automatiquement un caractère "/" à 5 | la fin des répertoires. 6 | -------------------------------------------------------------------------------- /missions/basic/09_rm_wildcard_hidden_spiders_cellar/treasure-msg/it.txt: -------------------------------------------------------------------------------- 1 | Congratulazioni! 2 | 3 | D'ora in poi, il comando ``ls`` sará 4 | utilizzato automaticamente per mostrare 5 | il carattere "/" alla fine delle cartelle. 6 | -------------------------------------------------------------------------------- /missions/basic/09_rm_wildcard_hidden_spiders_cellar/treasure.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # NOTE: --literal doesn't exist in freebsd 4 | if ls --literal / >/dev/null 2>/dev/null 5 | then 6 | alias ls='ls --literal -p' 7 | else 8 | alias ls='ls -p' 9 | fi 10 | -------------------------------------------------------------------------------- /missions/basic/10_cp_standard_great_hall/ascii-art/shield.txt: -------------------------------------------------------------------------------- 1 | 2 | |\ /) 3 | /\_\\__ (_// 4 | | `>\-` _._ //`) 5 | \ /` \\ _.-`:::`-._ // 6 | ` \|` ::: `|/ 7 | | ::: | 8 | |.....:::.....| 9 | |:::::::::::::| 10 | | ::: | 11 | \ ::: / 12 | \ ::: / 13 | `-. ::: .-' 14 | //`:::`\\ 15 | // ' \\ 16 | jgs |/ \\ 17 | 18 | -------------------------------------------------------------------------------- /missions/basic/10_cp_standard_great_hall/ascii-art/stag_head.txt: -------------------------------------------------------------------------------- 1 | 2 | /| |\ 3 | `__\\ //__' 4 | || || 5 | \__`\ |'__/ 6 | `_\\ //_' 7 | _.,:---;,._ 8 | \_: :_/ 9 | |@. .@| 10 | | | 11 | \.-./ 12 | `-' 13 | 14 | -------------------------------------------------------------------------------- /missions/basic/10_cp_standard_great_hall/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | cp "$(eval_gettext '$GSH_HOME/Castle/Great_hall')/$(gettext "standard")"_? "$GSH_CHEST" 4 | gsh check 5 | -------------------------------------------------------------------------------- /missions/basic/10_cp_standard_great_hall/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mission_source "$MISSION_DIR/clean0.sh" 4 | 5 | rm -f "$GSH_TMP/great_hall_contents" 6 | 7 | case "$GSH_LAST_ACTION" in 8 | check_true | skip) 9 | : 10 | ;; 11 | *) 12 | great_hall="$(eval_gettext '$GSH_HOME/Castle/Great_hall')" 13 | rm -f "$great_hall/*$(gettext "standard")*" 14 | rm -f "$GSH_CHEST"/*"$(gettext "standard")"* 15 | unset great_hall 16 | ;; 17 | esac 18 | 19 | -------------------------------------------------------------------------------- /missions/basic/10_cp_standard_great_hall/clean0.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | case "$GSH_LAST_ACTION" in 4 | check_true | skip) 5 | : 6 | ;; 7 | *) 8 | great_hall=$(eval_gettext '$GSH_HOME/Castle/Great_hall') 9 | rm -f "$great_hall"/*"$(gettext "stag_head")"* 10 | rm -f "$great_hall"/*"$(gettext "decorative_shield")"* 11 | rm -f "$great_hall"/*"$(gettext "suit_of_armour")"* 12 | rm -f "$GSH_CHEST"/*"$(gettext "stag_head")"* 13 | rm -f "$GSH_CHEST"/*"$(gettext "decorative_shield")"* 14 | rm -f "$GSH_CHEST"/*"$(gettext "suit_of_armour")"* 15 | unset great_hall 16 | ;; 17 | esac 18 | -------------------------------------------------------------------------------- /missions/basic/10_cp_standard_great_hall/goal/en.txt: -------------------------------------------------------------------------------- 1 | Mission goal 2 | ============ 3 | 4 | You have taken a fancy to the four standards in the great hall 5 | of the castle. As stealing them would not go unnoticed, put a 6 | copy (same name, same content) of each in your chest. 7 | 8 | 9 | Useful commands 10 | =============== 11 | 12 | cp FILE DIRNAME 13 | Copy the file to the directory. 14 | Remark: ``cp`` is an abbreviation of "copy". 15 | -------------------------------------------------------------------------------- /missions/basic/10_cp_standard_great_hall/goal/fr.txt: -------------------------------------------------------------------------------- 1 | Objectif 2 | ======== 3 | 4 | Les quatre étendards dans la grande salle du Château sont vraiment 5 | très jolis. Les voler ne passerait pas inaperçu, alors faites en 6 | une copie (même nom, même contenu) dans votre coffre. 7 | 8 | 9 | Commandes utiles 10 | ================ 11 | 12 | cp FICHIER REPERTOIRE 13 | Copie le fichier dans le répertoire. 14 | Note : ``cp`` est une abréviation pour "copy". 15 | -------------------------------------------------------------------------------- /missions/basic/10_cp_standard_great_hall/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivi Missione 2 | ============ 3 | 4 | Ti sei affezionato ai quattro stendardi nella grande sala 5 | del castello. Poiché rubandoli non passeresti inosservato, fai 6 | una copia (stesso nome, stesso contenuto) di ciascuno nella tua cassa. 7 | 8 | 9 | Comandi utili 10 | =============== 11 | 12 | cp FILE NOMECARTELLA 13 | Copia il file nella cartella. 14 | Nota: ``cp`` è una abbreviazione di "copy". 15 | -------------------------------------------------------------------------------- /missions/basic/10_cp_standard_great_hall/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | [ -z "$GSH_CHEST" ] && GSH_CHEST="$(eval_gettext '$GSH_HOME/Forest/Hut/Chest')" 4 | mkdir -p "$GSH_CHEST" 5 | 6 | _mission_init() ( 7 | mission_source "$MISSION_DIR/init0.sh" 8 | 9 | great_hall="$(eval_gettext '$GSH_HOME/Castle/Great_hall')" 10 | 11 | for i in $(seq 4) 12 | do 13 | f="$(gettext "standard")_${i}" 14 | touch "${great_hall}/${f}" 15 | sign_file "${great_hall}/${f}" 16 | done 17 | 18 | command ls "$great_hall" | sort > "$GSH_TMP/great_hall_contents" 19 | ) 20 | 21 | _mission_init 22 | -------------------------------------------------------------------------------- /missions/basic/10_cp_standard_great_hall/init0.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_init0() ( 4 | great_hall="$(eval_gettext '$GSH_HOME/Castle/Great_hall')" 5 | 6 | rm -f "$great_hall/"*_"$(gettext "stag_head")" 7 | sign_file "$MISSION_DIR/ascii-art/stag_head.txt" "$great_hall/$(RANDOM)_$(gettext "stag_head")" 8 | rm -f "$great_hall/"*_"$(gettext "decorative_shield")" 9 | sign_file "$MISSION_DIR/ascii-art/shield.txt" "$great_hall/$(RANDOM)_$(gettext "decorative_shield")" 10 | rm -f "$great_hall/"*_"$(gettext "suit_of_armour")" 11 | sign_file "$MISSION_DIR/ascii-art/armour.txt" "$great_hall/$(RANDOM)_$(gettext "suit_of_armour")" 12 | ) 13 | _mission_init0 14 | unset -f _mission_init0 15 | -------------------------------------------------------------------------------- /missions/basic/10_cp_standard_great_hall/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext "\$GSH_HOME/Castle/Great_hall")" 4 | -------------------------------------------------------------------------------- /missions/basic/10_cp_standard_great_hall/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | cp "$(eval_gettext '$GSH_HOME/Castle/Great_hall')/$(gettext "standard")"_? "$GSH_CHEST" 4 | gsh assert check true 5 | 6 | mv "$(eval_gettext '$GSH_HOME/Castle/Great_hall')/$(gettext "standard")"_? "$GSH_CHEST" 7 | gsh assert check false 8 | 9 | cp "$(eval_gettext '$GSH_HOME/Castle/Great_hall')"/* "$GSH_CHEST" 10 | gsh assert check false 11 | 12 | gsh assert check false 13 | 14 | cp "$(eval_gettext '$GSH_HOME/Castle/Great_hall')/$(gettext "standard")"_? "$GSH_CHEST" 15 | rm "$(eval_gettext '$GSH_HOME/Castle/Great_hall')"/*"$(gettext "stag_head")"* 16 | gsh assert check false 17 | 18 | -------------------------------------------------------------------------------- /missions/basic/11_cp_wildcards_tapestries_great_hall/ascii-art/tapestry-3.txt: -------------------------------------------------------------------------------- 1 | /\ /\ 2 | / \ / \ 3 | / /\ \/ /\ \ 4 | / / \/ / \ \ 5 | \ \ / /\ / / 6 | \ \/ /\ \/ / 7 | /\ \ \/ \ \/ /\ 8 | / \ /\ \ /\ \ / \ 9 | / /\ \/ /\ \/ /\ \/ /\ \ 10 | / / \/ / \/ / \/ / \ \ 11 | \ \ / /\ / /\ / /\ / / 12 | \ \/ /\ \/ /\ \/ /\ \/ / 13 | \ / \ \/ \ \/ \ / 14 | \/ /\ \ /\ \ \/ 15 | / /\ \/ /\ \ 16 | / / \/ / \ \ 17 | \ \ / /\ / / 18 | \ \/ /\ \/ / 19 | \ / \ / jgs 20 | \/ \/ 21 | -------------------------------------------------------------------------------- /missions/basic/11_cp_wildcards_tapestries_great_hall/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | cp "$(eval_gettext '$GSH_HOME/Castle/Great_hall')"/*"$(gettext "tapestry")"* "$GSH_CHEST" 4 | gsh check 5 | -------------------------------------------------------------------------------- /missions/basic/11_cp_wildcards_tapestries_great_hall/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mission_source "$MISSION_DIR"/clean0.sh 4 | 5 | rm -f "$GSH_TMP/great_hall_contents" 6 | 7 | case "$GSH_LAST_ACTION" in 8 | check_true | skip) 9 | : 10 | ;; 11 | *) 12 | great_hall=$(eval_gettext '$GSH_HOME/Castle/Great_hall') 13 | rm -f "$great_hall"/*"$(gettext "tapestry")"* 14 | rm -f "$GSH_CHEST"/*"$(gettext "tapestry")"* 15 | unset great_hall 16 | ;; 17 | esac 18 | 19 | -------------------------------------------------------------------------------- /missions/basic/11_cp_wildcards_tapestries_great_hall/clean0.sh: -------------------------------------------------------------------------------- 1 | ../10_cp_standard_great_hall/clean0.sh -------------------------------------------------------------------------------- /missions/basic/11_cp_wildcards_tapestries_great_hall/goal/en.txt: -------------------------------------------------------------------------------- 1 | Mission goal 2 | ============ 3 | 4 | The tapestries in the castle's great hall are also particularly 5 | beautiful. Put a copy of each in your chest. 6 | 7 | 8 | Useful commands 9 | =============== 10 | 11 | cp FILE1 FILE2 ... FILEn DIRNAME 12 | Copy the files to the directory. 13 | Remark: ``cp`` is an abbreviation of "copy". 14 | 15 | 16 | Shell patterns 17 | ============== 18 | 19 | * 20 | The "*" character stands in for any sequence of characters 21 | (including an empty sequence). 22 | 23 | ? 24 | The "?" character stands in for any single character. 25 | -------------------------------------------------------------------------------- /missions/basic/11_cp_wildcards_tapestries_great_hall/goal/fr.txt: -------------------------------------------------------------------------------- 1 | Objectif 2 | ======== 3 | 4 | Toutes les tapisseries de la grande salle du château sont 5 | également très élégantes. Mettez en une copie dans votre coffre. 6 | 7 | 8 | Commandes utiles 9 | ================ 10 | 11 | cp FICHIER1 FICHIER2 ... FICHIERn REPERTOIRE 12 | Copie les fichiers dans le répertoire. 13 | Note : ``cp`` est une abréviation pour "copy". 14 | 15 | 16 | Motifs shell 17 | ============ 18 | 19 | * 20 | Le caractère "*" est un joker pour n'importe quelle chaine de 21 | caractères. 22 | 23 | ? 24 | Le caractère "?" est un joker pour n'importe caractère. 25 | -------------------------------------------------------------------------------- /missions/basic/11_cp_wildcards_tapestries_great_hall/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivi Missione 2 | ============ 3 | 4 | Anche gli arazzi nella grande sala del castello sono bellissimi. 5 | Metti una copia di ciascuno nella tua cassa. 6 | 7 | 8 | Comandi utili 9 | =============== 10 | 11 | cp FILE1 FILE2 ... FILEn NOMECARTELLA 12 | Copia i file nella cartella. 13 | Nota: ``cp`` è una abbreviazione di "copy". 14 | 15 | 16 | Parametri Shell 17 | ============== 18 | 19 | * 20 | Il carattere "*" sta per ogni sequenza di caratteri 21 | (inclusa una frase vuota). 22 | 23 | ? 24 | Il carattere "?" sta per un qualunque singolo carattere. 25 | -------------------------------------------------------------------------------- /missions/basic/11_cp_wildcards_tapestries_great_hall/init0.sh: -------------------------------------------------------------------------------- 1 | ../10_cp_standard_great_hall/init0.sh -------------------------------------------------------------------------------- /missions/basic/11_cp_wildcards_tapestries_great_hall/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext "\$GSH_HOME/Castle/Great_hall")" 4 | -------------------------------------------------------------------------------- /missions/basic/11_cp_wildcards_tapestries_great_hall/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | cp "$(eval_gettext '$GSH_HOME/Castle/Great_hall')"/*"$(gettext "tapestry")"* "$GSH_CHEST" 4 | gsh assert check true 5 | 6 | mv "$(eval_gettext '$GSH_HOME/Castle/Great_hall')"/*"$(gettext "tapestry")"* "$GSH_CHEST" 7 | gsh assert check false 8 | 9 | cp "$(eval_gettext '$GSH_HOME/Castle/Great_hall')"/* "$GSH_CHEST" 10 | gsh assert check false 11 | 12 | gsh assert check false 13 | 14 | cp "$(eval_gettext '$GSH_HOME/Castle/Great_hall')"/*"$(gettext "tapestry")"* "$GSH_CHEST" 15 | rm "$(eval_gettext '$GSH_HOME/Castle/Great_hall')"/*"$(gettext "stag_head")"* 16 | gsh assert check false 17 | 18 | -------------------------------------------------------------------------------- /missions/basic/12_cp_ls_mtime_paintings_tower/ascii-art/painting-1: -------------------------------------------------------------------------------- 1 | ________________________ 2 | |.----------------------.| 3 | || || 4 | || ______ || 5 | || .;;;;;;;;. || 6 | || /;;;;;;;;;;;\ || 7 | || /;/` `-;;;;; . .|| 8 | || |;|__ __ \;;;| || 9 | ||.-.|;| e`/e` |;;;| || 10 | || |;| | |;;;|'--|| 11 | || |;| '- |;;;| || 12 | || |;;\ --' /|;;;| || 13 | || |;;;;;---'\|;;;| || 14 | || |;;;;| |;;;| || 15 | || |;;.-' |;;;| || 16 | ||'--|/` |;;;|--.|| 17 | ||;;;; . ;;;;.\;;|| 18 | ||;;;;;-.;_ /.-;;;;;;|| 19 | ||;;;;;;;;;;;;;;;;;;;;;;|| 20 | ||jgs;;;;;;;;;;;;;;;;;;;|| 21 | '------------------------' 22 | -------------------------------------------------------------------------------- /missions/basic/12_cp_ls_mtime_paintings_tower/ascii-art/painting-2: -------------------------------------------------------------------------------- 1 | 2 | 88Z8888 3 | D888$88 4 | 88888 5 | 88888 6 | 88Z88 7 | 888ZD8 8 | ZZ$M88D 88ZZ88 9 | 77MMMMMM88M I~:Z88 10 | NN877$MNNNMMM MM::=I7 11 | NNNNNNNNNNNNNN NMM88MI 12 | DDDDDDDDDNNNNNNNN8MMM 13 | 8888888DDNNNNNNNNMM 14 | 8OZZZO88DDNNNNNNNM 15 | Z$7$ZO88DNNNNNM 16 | Z$7$ZO88DNNNN 17 | NNZZO88DDNNNNNNN 18 | NNNNNNNNNNNNNNNNNNN 19 | 20 | Ceci n'est pas un fichier 21 | 22 | -------------------------------------------------------------------------------- /missions/basic/12_cp_ls_mtime_paintings_tower/ascii-art/painting-3: -------------------------------------------------------------------------------- 1 | 2 | /~\ 3 | |oo ) 4 | _\=/_ 5 | ___ / _ \ 6 | / ()\ //|/.\|\\ 7 | _|_____|_ || \_/ || 8 | | | === | | || |\ /| || 9 | |_| O |_| # \_ _/ # 10 | || O || | | | 11 | ||__*__|| | | | 12 | |~ \___/ ~| []|[] 13 | /=\ /=\ /=\ | | | Simon Jansen 14 | __________[_]_[_]_[_]________/_]_[_\________________ 15 | 16 | -------------------------------------------------------------------------------- /missions/basic/12_cp_ls_mtime_paintings_tower/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | filename=$(head -n1 "$GSH_TMP/painting") 4 | 5 | cp "$(eval_gettext '$GSH_HOME/Castle/Main_tower/First_floor')/$filename" "$GSH_CHEST" 6 | 7 | gsh check 8 | 9 | unset filename 10 | -------------------------------------------------------------------------------- /missions/basic/12_cp_ls_mtime_paintings_tower/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | rm -f "$GSH_TMP/painting" 4 | -------------------------------------------------------------------------------- /missions/basic/12_cp_ls_mtime_paintings_tower/goal/en.txt: -------------------------------------------------------------------------------- 1 | Mission goal 2 | ============ 3 | 4 | While wandering around the first floor of the main tower, some 5 | magnificent paintings catch your eye. Add a copy of the oldest one 6 | to your chest. 7 | 8 | 9 | Secondary objectives 10 | -------------------- 11 | 12 | Take a moment to admire the sheer beauty of the paintings. 13 | 14 | 15 | Useful commands 16 | =============== 17 | 18 | ls -l 19 | Print the list of files of the current directory, with additional 20 | information including last modification date. 21 | 22 | cat FILE 23 | Display the contents of the file. 24 | -------------------------------------------------------------------------------- /missions/basic/12_cp_ls_mtime_paintings_tower/goal/fr.txt: -------------------------------------------------------------------------------- 1 | Objectif 2 | ======== 3 | 4 | Au premier étage du donjon se trouvent de superbes tableaux. Ajoutez 5 | une copie du plus vieux d'entre eux à votre coffre. 6 | 7 | 8 | Objectif secondaire 9 | ------------------- 10 | 11 | Admirez aussi les trois tableaux. 12 | 13 | 14 | Commandes utiles 15 | ================ 16 | 17 | ls -l 18 | Affiche la liste des fichiers avec de nombreuses informations, 19 | incluant la date de modification. 20 | 21 | cat FICHIER 22 | Affiche le contenu du fichier à l'écran. 23 | Note : ``cat`` est une abréviation pour "concatenate", car la 24 | commande permet de concaténer plusieurs fichiers. 25 | -------------------------------------------------------------------------------- /missions/basic/12_cp_ls_mtime_paintings_tower/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivi Missione 2 | ============ 3 | 4 | Mentre vaghi per il primo piano della torre, alcuni 5 | dipinti magnifici catturano la tua vista. Aggiungi una copia del 6 | più vecchio nella tua cassa. 7 | 8 | 9 | Obiettivi secondari 10 | -------------------- 11 | 12 | Prenditi un momento per ammirare i dipinti. 13 | 14 | Comandi utili 15 | =============== 16 | 17 | ls -l 18 | Stampa un elenco di file della cartella attuale, con informazioni 19 | aggiuntive incluse la data di ultima modifica. 20 | 21 | cat FILE 22 | Mostra il contenuto del file. 23 | -------------------------------------------------------------------------------- /missions/basic/12_cp_ls_mtime_paintings_tower/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext "\$GSH_HOME/Castle/Main_tower/First_floor")" 4 | -------------------------------------------------------------------------------- /missions/basic/12_cp_ls_mtime_paintings_tower/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | cp "$(eval_gettext '$GSH_HOME/Castle/Main_tower/First_floor')/$(head -n1 "$GSH_TMP/painting")" "$GSH_CHEST" 4 | gsh assert check true 5 | 6 | gsh assert check false 7 | 8 | cp "$(eval_gettext '$GSH_HOME/Castle/Main_tower/First_floor')/$(gettext "painting")_"* "$GSH_CHEST" 9 | gsh assert check false 10 | 11 | gsh assert '[ "$(find "$GSH_HOME" -name "'$(gettext "painting")'_*" | wc -l)" -eq 3 ]' 12 | 13 | cp "$(eval_gettext '$GSH_HOME/Castle/Main_tower/First_floor')/$(head -n1 "$GSH_TMP/painting")" "$GSH_CHEST" 14 | gsh assert check true 15 | -------------------------------------------------------------------------------- /missions/basic/default.idx: -------------------------------------------------------------------------------- 1 | 01_cd_tower 2 | 02_cd.._cellar 3 | 03_cd_HOME_throne 4 | 04_mkdir_chest 5 | 05_rm_spiders_cellar 6 | 06_mv_coins_garden 7 | 07_mv_hidden_coins_garden 8 | 08_rm_wildcard_spiders_cellar 9 | 09_rm_wildcard_hidden_spiders_cellar 10 | 10_cp_standard_great_hall 11 | 11_cp_wildcards_tapestries_great_hall 12 | 12_cp_ls_mtime_paintings_tower 13 | -------------------------------------------------------------------------------- /missions/contrib/.keep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/phyver/GameShell/d8e2f9a34f74ced097fb5e95be33682ae794c901/missions/contrib/.keep -------------------------------------------------------------------------------- /missions/default.idx: -------------------------------------------------------------------------------- 1 | # default Gameshell missions order 2 | 3 | basic/default.idx 4 | misc/01_cal_nostradamus 5 | intermediate/01_alias_la 6 | misc/02_nano_journal 7 | intermediate/02_alias_journal 8 | intermediate/03_tab_spider_lair 9 | intermediate/04_bg_xeyes 10 | intermediate/05_background 11 | intermediate/06_control-C 12 | !finding_files_maze/00_shared 13 | finding_files_maze/01_ls_cd 14 | finding_files_maze/02_tree 15 | finding_files_maze/03_find_1 16 | pipe_intro_book_of_potions/default.idx 17 | processes/default.idx 18 | stdin_stdout_stderr/default.idx 19 | permissions/default.idx 20 | finding_files_maze/04_find_2 21 | finding_files_maze/05_find_xargs_grep 22 | pipes_merchant_stall/default.idx 23 | misc/03_tr_caesar_shift 24 | FINAL_MISSION 25 | -------------------------------------------------------------------------------- /missions/finding_files_maze/00_shared/ascii-art/bucket.txt: -------------------------------------------------------------------------------- 1 | ,.--'`````'--., 2 | (\'-.,_____,.-'/) 3 | \\-.,_____,.-// 4 | ;\\ //| 5 | | \\ ___ // | 6 | | '-[___]-' | 7 | | | 8 | | | 9 | | | 10 | `'-.,_____,.-'' jgs 11 | 12 | -------------------------------------------------------------------------------- /missions/finding_files_maze/00_shared/ascii-art/flowers.txt: -------------------------------------------------------------------------------- 1 | _ 2 | _(_)_ wWWWw _ 3 | @@@@ (_)@(_) vVVVv _ @@@@ (___) _(_)_ 4 | @@()@@ wWWWw (_)\ (___) _(_)_ @@()@@ Y (_)@(_) 5 | @@@@ (___) `|/ Y (_)@(_) @@@@ \|/ (_)\ 6 | / Y \| \|/ /(_) \| |/ | 7 | \ | \ |/ | / \ | / \|/ |/ \| \|/ 8 | jgs \\|// \\|/// \\\|//\\\|/// \|/// \\\|// \\|// \\\|// 9 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 10 | 11 | -------------------------------------------------------------------------------- /missions/finding_files_maze/00_shared/ascii-art/wheelbarrow.txt: -------------------------------------------------------------------------------- 1 | _______ 2 | ___________________________.'.------` 3 | '---------------------------.' 4 | `. .' 5 | .-//`. .' 6 | .' .//.'/`================' 7 | =[=:====:=]= \\|| 8 | '. `--' .' LGB \_| 9 | `- -' 10 | 11 | -------------------------------------------------------------------------------- /missions/finding_files_maze/00_shared/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | maze="$(eval_gettext '$GSH_HOME/Garden/Maze')" 4 | case $(pwd -P) in 5 | "$maze"/?*) 6 | cd "$maze" 7 | echo "$(gettext "You are back at the entrance of the maze...")" 8 | ;; 9 | esac 10 | 11 | case "$maze" in 12 | */World/*) 13 | rm -rf "$maze"/?* 14 | ;; 15 | *) 16 | echo "Error: I don't want to remove the content of $maze!" 17 | exit 1 18 | ;; 19 | esac 20 | unset maze 21 | -------------------------------------------------------------------------------- /missions/finding_files_maze/00_shared/i18n/en.po: -------------------------------------------------------------------------------- 1 | # AUTOMATICALLY GENERATED -- DO NOT EDIT 2 | msgid "" 3 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 4 | "Content-Transfer-Encoding: 8bit\n" 5 | 6 | #, sh-format 7 | msgid "$GSH_HOME/Garden/Flower_garden" 8 | msgstr "$GSH_HOME/Garden/Flower_garden" 9 | 10 | #, sh-format 11 | msgid "$GSH_HOME/Garden/Maze" 12 | msgstr "$GSH_HOME/Garden/Maze" 13 | 14 | #, sh-format 15 | msgid "$GSH_HOME/Garden/Shed" 16 | msgstr "$GSH_HOME/Garden/Shed" 17 | 18 | msgid "You are back at the entrance of the maze..." 19 | msgstr "You are back at the entrance of the maze..." 20 | 21 | msgid "bucket" 22 | msgstr "bucket" 23 | 24 | msgid "flowers" 25 | msgstr "flowers" 26 | 27 | msgid "wheelbarrow" 28 | msgstr "wheelbarrow" 29 | -------------------------------------------------------------------------------- /missions/finding_files_maze/00_shared/i18n/fr.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 3 | "Content-Transfer-Encoding: 8bit\n" 4 | 5 | #, sh-format 6 | msgid "$GSH_HOME/Garden/Flower_garden" 7 | msgstr "$GSH_HOME/Jardin/Jardin_des_fleurs" 8 | 9 | #, sh-format 10 | msgid "$GSH_HOME/Garden/Maze" 11 | msgstr "$GSH_HOME/Jardin/Labyrinthe" 12 | 13 | #, sh-format 14 | msgid "$GSH_HOME/Garden/Shed" 15 | msgstr "$GSH_HOME/Jardin/Cabanon" 16 | 17 | msgid "You are back at the entrance of the maze..." 18 | msgstr "Vous voila de retour à l'entrée du labyrinthe..." 19 | 20 | msgid "bucket" 21 | msgstr "seau" 22 | 23 | msgid "flowers" 24 | msgstr "fleurs" 25 | 26 | msgid "wheelbarrow" 27 | msgstr "brouette" 28 | -------------------------------------------------------------------------------- /missions/finding_files_maze/00_shared/i18n/it.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 3 | "Content-Transfer-Encoding: 8bit\n" 4 | 5 | #, sh-format 6 | msgid "$GSH_HOME/Garden/Flower_garden" 7 | msgstr "$GSH_HOME/Giardino/Giardino_fiorito" 8 | 9 | #, sh-format 10 | msgid "$GSH_HOME/Garden/Maze" 11 | msgstr "$GSH_HOME/Giardino/Labirinto" 12 | 13 | #, sh-format 14 | msgid "$GSH_HOME/Garden/Shed" 15 | msgstr "$GSH_HOME/Giardino/Rimessa" 16 | 17 | msgid "You are back at the entrance of the maze..." 18 | msgstr "Sei di nuovo all'entrata del labirinto..." 19 | 20 | msgid "bucket" 21 | msgstr "secchio" 22 | 23 | msgid "flowers" 24 | msgstr "fiori" 25 | 26 | msgid "wheelbarrow" 27 | msgstr "carriola" 28 | 29 | -------------------------------------------------------------------------------- /missions/finding_files_maze/00_shared/i18n/template.pot: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 3 | "Content-Transfer-Encoding: 8bit\n" 4 | 5 | #, sh-format 6 | msgid "$GSH_HOME/Garden/Flower_garden" 7 | msgstr "" 8 | 9 | #, sh-format 10 | msgid "$GSH_HOME/Garden/Maze" 11 | msgstr "" 12 | 13 | #, sh-format 14 | msgid "$GSH_HOME/Garden/Shed" 15 | msgstr "" 16 | 17 | msgid "You are back at the entrance of the maze..." 18 | msgstr "" 19 | 20 | msgid "bucket" 21 | msgstr "" 22 | 23 | msgid "flowers" 24 | msgstr "" 25 | 26 | msgid "wheelbarrow" 27 | msgstr "" 28 | -------------------------------------------------------------------------------- /missions/finding_files_maze/00_shared/sbin/generate_maze.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | DIR=$1 4 | DEPTH=$2 5 | WIDTH=$3 6 | nb_path=$4 7 | stone=$5 8 | 9 | awk -v DIR="$DIR" \ 10 | -v DEPTH="$DEPTH" \ 11 | -v WIDTH="$WIDTH" \ 12 | -v nb_random_path="$nb_path" \ 13 | -v leaf_content="$stone" \ 14 | -v seed_file="$GSH_CONFIG/PRNG_seed" \ 15 | -f "$MISSION_DIR/sbin/generate_maze.awk" 16 | -------------------------------------------------------------------------------- /missions/finding_files_maze/00_shared/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext '$GSH_HOME/Garden/Maze')" 4 | mkdir -p "$(eval_gettext '$GSH_HOME/Garden/Flower_garden')" 5 | mkdir -p "$(eval_gettext '$GSH_HOME/Garden/Shed')" 6 | 7 | sign_file "$MISSION_DIR/ascii-art/bucket.txt" "$(eval_gettext '$GSH_HOME/Garden/Shed')/$(gettext "bucket")" 8 | sign_file "$MISSION_DIR/ascii-art/flowers.txt" "$(eval_gettext '$GSH_HOME/Garden/Flower_garden')/$(gettext "flowers")" 9 | sign_file "$MISSION_DIR/ascii-art/wheelbarrow.txt" "$(eval_gettext '$GSH_HOME/Garden/Shed')/$(gettext "wheelbarrow")" 10 | 11 | -------------------------------------------------------------------------------- /missions/finding_files_maze/01_ls_cd/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ( 4 | cd "$(eval_gettext '$GSH_HOME/Garden/Maze')" 5 | find . -name "*_$(gettext "copper_coin")_*" -type f -exec mv "{}" "$GSH_CHEST" \; 6 | ) 7 | gsh check 8 | -------------------------------------------------------------------------------- /missions/finding_files_maze/01_ls_cd/check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_check() ( 4 | maze="$(eval_gettext '$GSH_HOME/Garden/Maze')" 5 | 6 | coin=$(find "$maze" -name "*_$(gettext "copper_coin")_*") 7 | 8 | if [ -n "$coin" ] 9 | then 10 | echo "$(gettext "There still are some copper coins in the maze!")" 11 | return 1 12 | fi 13 | 14 | coin=$(find "$GSH_CHEST" -maxdepth 1 -name "*_$(gettext "copper_coin")_*") 15 | if [ -z "$coin" ] 16 | then 17 | echo "$(gettext "There is no copper coin in your chest!")" 18 | return 1 19 | fi 20 | 21 | if ! cmp -s "$coin" "$GSH_TMP/copper_coin" 22 | then 23 | echo "$(gettext "Booh... The copper coin in you chest is invalid!")" 24 | return 1 25 | fi 26 | ) 27 | 28 | _mission_check 29 | -------------------------------------------------------------------------------- /missions/finding_files_maze/01_ls_cd/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # protect the root directory 4 | [ "$GSH_MODE" != "DEBUG" ] && ! [ -d "$GSH_ROOT/.git" ] && gsh protect 5 | 6 | . "$MISSION_DIR/../00_shared/clean.sh" 7 | rm -f "$GSH_TMP/copper_coin" 8 | -------------------------------------------------------------------------------- /missions/finding_files_maze/01_ls_cd/goal.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | maze="$(eval_gettext '$GSH_HOME/Garden/Maze')" 4 | # NOTE: POSIX sed doesn't support using another character than '/' in "s/.../.../" 5 | maze=$(echo "$maze" | sed 's/\//\\\//g') 6 | sed "s/\\\$maze/$maze/g" "$(eval_gettext '$MISSION_DIR/goal/en.txt')" 7 | unset maze 8 | -------------------------------------------------------------------------------- /missions/finding_files_maze/01_ls_cd/goal/en.txt: -------------------------------------------------------------------------------- 1 | Mission goal 2 | ============ 3 | 4 | Find the copper coin in the small maze in the garden and move it to 5 | your chest. 6 | 7 | If you want, you can use a graphical file manager. The maze 8 | is to be found in directory 9 | $maze 10 | -------------------------------------------------------------------------------- /missions/finding_files_maze/01_ls_cd/goal/fr.txt: -------------------------------------------------------------------------------- 1 | Objectif 2 | ======== 3 | 4 | Retrouvez la pièce de bronze dans le (petit) labyrinthe du jardin et 5 | déplacez-la dans votre coffre. 6 | 7 | Vous pouvez utiliser le gestionnaire de fichiers graphique si vous 8 | le souhaitez. Pour cela, il faut aller dans le répertoire 9 | $maze 10 | -------------------------------------------------------------------------------- /missions/finding_files_maze/01_ls_cd/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivi missione 2 | ==================== 3 | 4 | Trova la moneta di rame nel piccolo labirinto nel giardino e spostala 5 | nella tua cassa. 6 | 7 | Se vuoi, puoi usare un file manager grafico. Il labirinto si trova 8 | nella cartella 9 | $maze 10 | -------------------------------------------------------------------------------- /missions/finding_files_maze/01_ls_cd/static.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/static.sh -------------------------------------------------------------------------------- /missions/finding_files_maze/01_ls_cd/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ( 4 | gsh assert check false 5 | ) 6 | 7 | ( 8 | cd "$(eval_gettext '$GSH_HOME/Garden/Maze')" 9 | find . -name "*_$(gettext "copper_coin")_*" -type f | xargs rm -rf 10 | gsh assert check false 11 | ) 12 | 13 | ( 14 | cd "$(eval_gettext '$GSH_HOME/Garden/Maze')" 15 | find . -name "*_$(gettext "copper_coin")_*" -type f | xargs rm -rf 16 | echo "coin" > "$(eval_gettext '$GSH_HOME/Garden/Maze')/copper_coin" 17 | gsh assert check false 18 | ) 19 | 20 | ( 21 | cd "$(eval_gettext '$GSH_HOME/Garden/Maze')" 22 | find . -name "*_$(gettext "copper_coin")_*" -type f -exec mv "{}" "$GSH_CHEST" \; 23 | gsh assert check true 24 | ) 25 | 26 | -------------------------------------------------------------------------------- /missions/finding_files_maze/01_ls_cd/treasure-msg.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | if command ls --color >/dev/null 2>/dev/null 4 | then 5 | # standard linux 6 | cat "$(eval_gettext '$MISSION_DIR/treasure-msg/en.txt')" 7 | elif command ls -G >/dev/null 2>/dev/null 8 | then 9 | # freebsd, macOS use another flag for colors: -G 10 | cat "$(eval_gettext '$MISSION_DIR/treasure-msg/en.txt')" 11 | else 12 | # openbsd doesn't use colors at all 13 | : 14 | fi 15 | 16 | 17 | -------------------------------------------------------------------------------- /missions/finding_files_maze/01_ls_cd/treasure-msg/en.txt: -------------------------------------------------------------------------------- 1 | Congratulations! 2 | 3 | From now on, the command ``ls`` will try 4 | using a color code to make it easier to 5 | differentiate between directories and several 6 | kinds of files. 7 | -------------------------------------------------------------------------------- /missions/finding_files_maze/01_ls_cd/treasure-msg/fr.txt: -------------------------------------------------------------------------------- 1 | Bravo ! 2 | 3 | À partir de maintenant, la commande ``ls`` 4 | essaiera d'utiliser un code couleur pour 5 | différencier les fichiers et les répertoires, 6 | ainsi que certains types de fichiers. 7 | -------------------------------------------------------------------------------- /missions/finding_files_maze/01_ls_cd/treasure-msg/it.txt: -------------------------------------------------------------------------------- 1 | Congratulazioni! 2 | 3 | Da ora, il comando ``ls`` proverà ad usare un codice di colori per 4 | identificare più facilmente fra cartelle e diversi tipi di file. 5 | -------------------------------------------------------------------------------- /missions/finding_files_maze/01_ls_cd/treasure.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # NOTE: --literal doesn't exist in freebsd 4 | # --color doesn't exist in macos, it is replaced by -G 5 | # colors do not exist in openbsd! 6 | # 7 | if ls --literal >/dev/null 2>/dev/null 8 | then 9 | if ls --color=auto >/dev/null 2>/dev/null 10 | then 11 | alias ls='ls --literal -p --color=auto' 12 | elif ls -G >/dev/null 2>/dev/null 13 | then 14 | alias ls='ls --literal -p -G' 15 | fi 16 | else 17 | if ls --color=auto >/dev/null 2>/dev/null 18 | then 19 | export COLORTERM=1 # necessary for freeBSD 20 | alias ls='ls -p --color=auto' 21 | elif ls -G / >/dev/null 2>/dev/null 22 | then 23 | alias ls='ls -p -G' 24 | fi 25 | fi 26 | -------------------------------------------------------------------------------- /missions/finding_files_maze/02_tree/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ( 4 | cd "$(eval_gettext '$GSH_HOME/Garden/Maze')" 5 | find . -name "*$(gettext "silver_coin")*" -type f -exec mv "{}" "$GSH_CHEST" \; 6 | ) 7 | gsh check 8 | -------------------------------------------------------------------------------- /missions/finding_files_maze/02_tree/check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_check() ( 4 | maze="$(eval_gettext '$GSH_HOME/Garden/Maze')" 5 | 6 | coin=$(find "$maze" -name "*$(gettext "silver_coin")*") 7 | 8 | if [ -n "$coin" ] 9 | then 10 | echo "$(gettext "There still are some silver coins in the maze!")" 11 | return 1 12 | fi 13 | 14 | coin=$(find "$GSH_CHEST" -maxdepth 1 -name "*$(gettext "silver_coin")*") 15 | if [ -z "$coin" ] 16 | then 17 | echo "$(gettext "There is no silver coin in your chest!")" 18 | return 1 19 | fi 20 | 21 | if ! cmp -s "$coin" "$GSH_TMP/silver_coin" 22 | then 23 | echo "$(gettext "The silver coin in you chest is invalid!")" 24 | return 1 25 | fi 26 | ) 27 | 28 | _mission_check 29 | -------------------------------------------------------------------------------- /missions/finding_files_maze/02_tree/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | . "$MISSION_DIR/../00_shared/clean.sh" 4 | rm -f "$GSH_TMP/silver_coin" 5 | -------------------------------------------------------------------------------- /missions/finding_files_maze/02_tree/goal/en.txt: -------------------------------------------------------------------------------- 1 | Mission goal 2 | ============ 3 | 4 | Find the silver coin in the maze in the garden and move it to your 5 | chest using the shell. 6 | 7 | 8 | Useful commands 9 | =============== 10 | 11 | ls -R 12 | Print the list of all files / directory, including those in 13 | sub-directories (recursively). 14 | 15 | tree 16 | Print the tree of files and directories, starting from the 17 | current working directory. 18 | -------------------------------------------------------------------------------- /missions/finding_files_maze/02_tree/goal/fr.txt: -------------------------------------------------------------------------------- 1 | Objectif 2 | ======== 3 | 4 | Retrouvez la pièce d'argent dans le (petit) labyrinthe du jardin et 5 | déplacez-la dans votre coffre en utilisant le shell. 6 | 7 | 8 | Commandes utiles 9 | ================ 10 | 11 | ls -R 12 | Affiche la liste des fichiers, y compris dans les 13 | sous-répertoires. 14 | 15 | tree 16 | Affiche l'arborescence des fichiers et répertoires depuis le 17 | répertoire courant. 18 | 19 | Remarque : la commande "tree" n'est pas standard et pas toujours 20 | installée par défaut. 21 | -------------------------------------------------------------------------------- /missions/finding_files_maze/02_tree/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivi missione 2 | ==================== 3 | 4 | Trova la moneta d'argento nel labirinto nel giardino e spostala nella 5 | tua cassa usando il terminale. 6 | 7 | Comandi utili 8 | ============= 9 | 10 | ls -R 11 | Stampa la lista di tutti i file / cartelle, includendo quelli nelle 12 | sottocartelle (ricorsivamente). 13 | 14 | tree 15 | Stampa l'albero dei file e delle cartelle, partendo dalla cartella 16 | corrente. 17 | -------------------------------------------------------------------------------- /missions/finding_files_maze/02_tree/static.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/static.sh -------------------------------------------------------------------------------- /missions/finding_files_maze/02_tree/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | gsh assert check false 4 | 5 | ( 6 | cd "$(eval_gettext '$GSH_HOME/Garden/Maze')" 7 | 8 | find . -name "*$(gettext "silver_coin")*" -type f | xargs rm -rf 9 | gsh assert check false 10 | 11 | find . -name "*$(gettext "silver_coin")*" -type f | xargs rm -rf 12 | echo "coin" > "$(eval_gettext '$GSH_HOME/Garden/Maze')/silver_coin" 13 | gsh assert check false 14 | 15 | find . -name "*$(gettext "silver_coin")*" -type f -exec mv "{}" "$GSH_CHEST" \; 16 | gsh assert check true 17 | ) 18 | -------------------------------------------------------------------------------- /missions/finding_files_maze/03_find_1/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ( 4 | cd "$(eval_gettext '$GSH_HOME/Garden/Maze')" 5 | find . -iname "*$(gettext "coin")*" -type f -exec mv "{}" "$GSH_CHEST" \; 6 | ) 7 | gsh check 8 | -------------------------------------------------------------------------------- /missions/finding_files_maze/03_find_1/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | . "$MISSION_DIR/../00_shared/clean.sh" 4 | rm -f "$GSH_TMP"/gold_coin_* "$GSH_TMP"/GolD_CoiN_* 5 | -------------------------------------------------------------------------------- /missions/finding_files_maze/03_find_1/static.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/static.sh -------------------------------------------------------------------------------- /missions/finding_files_maze/03_find_1/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | gsh assert check false 4 | 5 | ( 6 | cd "$(eval_gettext '$GSH_HOME/Garden/Maze')" 7 | 8 | find . -iname "*$(gettext "gold_coin")*" -type f | xargs rm -rf 9 | gsh assert check false 10 | 11 | find . -iname "*$(gettext "gold_coin")*" -type f | xargs rm -rf 12 | echo "coin" > "$(eval_gettext '$GSH_HOME/Garden/Maze')/gold_coin" 13 | gsh assert check false 14 | 15 | find . -iname "*$(gettext "gold_coin")*" -type f -exec mv "{}" "$GSH_CHEST" \; 16 | gsh assert check true 17 | ) 18 | -------------------------------------------------------------------------------- /missions/finding_files_maze/04_find_2/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ( 4 | cd "$(eval_gettext '$GSH_HOME/Garden/Maze')" 5 | find . -type f | xargs grep -l "$(gettext "ruby")" | xargs -I"{}" mv "{}" "$GSH_CHEST" 6 | ) 7 | gsh check 8 | -------------------------------------------------------------------------------- /missions/finding_files_maze/04_find_2/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | . "$MISSION_DIR/../00_shared/clean.sh" 4 | rm -f "$GSH_TMP/ruby" 5 | -------------------------------------------------------------------------------- /missions/finding_files_maze/04_find_2/static.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/static.sh -------------------------------------------------------------------------------- /missions/finding_files_maze/04_find_2/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | gsh assert check false 4 | 5 | ( 6 | cd "$(eval_gettext '$GSH_HOME/Garden/Maze')" 7 | find . -type f -print0 | xargs -0 grep -l "$(gettext "ruby")" | xargs rm 8 | gsh assert check false 9 | ) 10 | 11 | ( 12 | cd "$(eval_gettext '$GSH_HOME/Garden/Maze')" 13 | find . -type f -print0 | xargs -0 grep -l "$(gettext "ruby")" | xargs rm 14 | echo "ruby" > "$(eval_gettext '$GSH_HOME/Garden/Maze')/12345" 15 | gsh assert check false 16 | ) 17 | 18 | ( 19 | cd "$(eval_gettext '$GSH_HOME/Garden/Maze')" 20 | find . -type f -print0 | xargs -0 grep -l "$(gettext "ruby")" | xargs -I"{}" mv "{}" "$GSH_CHEST" 21 | gsh assert check true 22 | ) 23 | -------------------------------------------------------------------------------- /missions/finding_files_maze/05_find_xargs_grep/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ( 4 | cd "$(eval_gettext '$GSH_HOME/Garden/Maze')" 5 | find . -type f | xargs grep -l "$(gettext "diamond")" | xargs -I"{}" mv "{}" "$GSH_CHEST" 6 | ) 7 | gsh check 8 | -------------------------------------------------------------------------------- /missions/finding_files_maze/05_find_xargs_grep/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | . "$MISSION_DIR/../00_shared/clean.sh" 4 | rm -f "$GSH_TMP/diamond" 5 | -------------------------------------------------------------------------------- /missions/finding_files_maze/05_find_xargs_grep/static.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/static.sh -------------------------------------------------------------------------------- /missions/finding_files_maze/05_find_xargs_grep/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | gsh assert check false 4 | 5 | ( 6 | cd "$(eval_gettext '$GSH_HOME/Garden/Maze')" 7 | find . -type f -print0 | xargs -0 grep -l "$(gettext "diamond")" | xargs rm 8 | gsh assert check false 9 | ) 10 | 11 | ( 12 | cd "$(eval_gettext '$GSH_HOME/Garden/Maze')" 13 | find . -type f -print0 | xargs -0 grep -l "$(gettext "diamond")" | xargs rm 14 | echo "diamond" > "$(eval_gettext '$GSH_HOME/Garden/Maze')/12345" 15 | gsh assert check false 16 | ) 17 | 18 | ( 19 | cd "$(eval_gettext '$GSH_HOME/Garden/Maze')" 20 | find . -type f -print0 | xargs -0 grep -l "$(gettext "diamond")" | xargs -I"{}" mv "{}" "$GSH_CHEST" 21 | gsh assert check true 22 | ) 23 | -------------------------------------------------------------------------------- /missions/finding_files_maze/default.idx: -------------------------------------------------------------------------------- 1 | !00_shared 2 | 01_ls_cd 3 | 02_tree 4 | 03_find_1 5 | 04_find_2 6 | 05_find_xargs_grep 7 | -------------------------------------------------------------------------------- /missions/intermediate/01_alias_la/ascii-art/diamond.txt: -------------------------------------------------------------------------------- 1 | . ' , 2 | _________ 3 | _ /_|_____|_\ _ 4 | '. \ / .' 5 | '.\ /.' 6 | '.' Donovan Bake 7 | -------------------------------------------------------------------------------- /missions/intermediate/01_alias_la/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | alias la="ls -A" 4 | gsh check 5 | -------------------------------------------------------------------------------- /missions/intermediate/01_alias_la/goal.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | cp "$MISSION_DIR/ascii-art/diamond.txt" ./".$(gettext "nice_rock")" 4 | cat "$(eval_gettext '$MISSION_DIR/goal/en.txt')" 5 | 6 | -------------------------------------------------------------------------------- /missions/intermediate/01_alias_la/goal/en.txt: -------------------------------------------------------------------------------- 1 | Mission goal 2 | ============ 3 | 4 | Checking for hidden files is taking too long! 5 | 6 | Create an alias "la" to run the command ``ls -A`` in order to list 7 | all files, including hidden ones, with only 2 letters. 8 | 9 | Define the synonym 10 | 11 | la 12 | 13 | for the command 14 | 15 | ls -A 16 | 17 | and check that it works as expected. 18 | 19 | How fortunate, there is a nice rock hidden just where you are. 20 | 21 | 22 | Useful commands 23 | =============== 24 | 25 | alias STRING='COMMAND' 26 | Create a synonym for a string, that will stand for a command. 27 | -------------------------------------------------------------------------------- /missions/intermediate/01_alias_la/goal/fr.txt: -------------------------------------------------------------------------------- 1 | Objectif 2 | ======== 3 | 4 | Chercher les fichiers cachés prend trop de temps. 5 | 6 | Créez un raccourci "la" qui lance la commande ``ls -A`` pour 7 | afficher les fichiers, en incluant les fichiers cachés, avec 8 | seulement 2 lettres ! 9 | 10 | Définissez pour ceci le synonyme 11 | 12 | la 13 | 14 | pour la commande 15 | 16 | ls -A 17 | 18 | et vérifiez que ``la`` affiche bien les fichiers cachés. 19 | 20 | Ça tombe bien, il y a un joli caillou caché juste là où vous êtes. 21 | 22 | 23 | Commandes utiles 24 | ================ 25 | 26 | alias CHAINE='COMMANDE' 27 | Crée un synonyme pour une chaine de caractères, qui sera remplacée 28 | par la commande. 29 | -------------------------------------------------------------------------------- /missions/intermediate/01_alias_la/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivi Missione 2 | ============ 3 | 4 | Controllare i file nascosti prende troppo tempo! 5 | 6 | Crea un alias "la" ed esegui il comando ``ls -A`` per elencare 7 | tutti i file, inclusi quelli nascosti, con solo 2 lettere. 8 | 9 | Definisci il sinonimo 10 | 11 | la 12 | 13 | per il comando 14 | 15 | ls -A 16 | 17 | e controlla che lavori come ti aspetti. 18 | 19 | Che fortuna, c'è una bella roccia nascosta proprio dove sei tu. 20 | 21 | 22 | Comandi utili 23 | =============== 24 | 25 | alias STRING='COMMAND' 26 | Crea un sinonimo per una stringa, che sostituirà il comando. 27 | -------------------------------------------------------------------------------- /missions/intermediate/01_alias_la/i18n/template.pot: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 3 | "Content-Transfer-Encoding: 8bit\n" 4 | 5 | # path for the text file containing the goal 6 | #, sh-format 7 | msgid "$MISSION_DIR/goal/en.txt" 8 | msgstr "" 9 | 10 | # path for the text file containing the skip message 11 | msgid "$MISSION_DIR/skip/en.txt" 12 | msgstr "" 13 | 14 | # path for the text file containing the treasure message 15 | msgid "$MISSION_DIR/treasure-msg/en.txt" 16 | msgstr "" 17 | 18 | msgid "The alias 'la' doesn't exist..." 19 | msgstr "" 20 | 21 | msgid "The alias 'la' doesn't run 'ls -A'..." 22 | msgstr "" 23 | 24 | msgid "The alias 'la' is invalid..." 25 | msgstr "" 26 | 27 | msgid "nice_rock" 28 | msgstr "" 29 | -------------------------------------------------------------------------------- /missions/intermediate/01_alias_la/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | alias la="ls -A" 4 | gsh assert check true 5 | unalias la 2>/dev/null 6 | 7 | # # doesn't work on zsh 8 | # alias la=" ls -A " 9 | # gsh assert check true 10 | # unalias la 2>/dev/null 11 | 12 | alias la="ls -a" 13 | gsh assert check false 14 | unalias la 2>/dev/null 15 | 16 | alias LA="ls -a" 17 | gsh assert check false 18 | unalias LA 2>/dev/null 19 | -------------------------------------------------------------------------------- /missions/intermediate/01_alias_la/treasure.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # NOTE: --literal doesn't exist in freebsd 4 | if ls --literal / >/dev/null 2>/dev/null 5 | then 6 | alias la='ls --literal -A' 7 | else 8 | alias la='ls -A' 9 | fi 10 | -------------------------------------------------------------------------------- /missions/intermediate/02_alias_journal/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | alias "$(gettext "journal")"="nano \"\$GSH_CHEST/$(gettext "journal").txt\"" 4 | gsh check 5 | -------------------------------------------------------------------------------- /missions/intermediate/02_alias_journal/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | case "$GSH_LAST_ACTION" in 4 | "check_true") 5 | ;; 6 | *) 7 | unalias "$(gettext "journal")" 2>/dev/null 8 | unset EDITOR 9 | ;; 10 | esac 11 | -------------------------------------------------------------------------------- /missions/intermediate/02_alias_journal/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | if ! command -v nano >/dev/null; then 4 | echo "$(eval_gettext "The command 'nano' is required for mission \$MISSION_NAME. 5 | (Debian / Ubuntu: install package 'nano')")" >&2 6 | false 7 | else 8 | [ -z "$GSH_CHEST" ] && GSH_CHEST="$(eval_gettext '$GSH_HOME/Forest/Hut/Chest')" 9 | mkdir -p "$GSH_CHEST" 10 | fi 11 | -------------------------------------------------------------------------------- /missions/intermediate/02_alias_journal/static.sh: -------------------------------------------------------------------------------- 1 | cp "$(eval_gettext '$MISSION_DIR/gshrc/en.sh')" "$GSH_CONFIG/player.gshrc" 2 | -------------------------------------------------------------------------------- /missions/intermediate/02_alias_journal/treasure-msg/en.txt: -------------------------------------------------------------------------------- 1 | Congratulations! 2 | 3 | From now on you can use the file 4 | "~/.gshrc" 5 | to record aliases. More information can be 6 | found in the file (it has been created for 7 | you). 8 | -------------------------------------------------------------------------------- /missions/intermediate/02_alias_journal/treasure-msg/fr.txt: -------------------------------------------------------------------------------- 1 | Bravo ! 2 | 3 | Vous pouvez maintenant utiliser le fichier 4 | "~/.gshrc" 5 | pour sauvegarder des alias. D'autres 6 | informations ont été écrites dans le fichier 7 | (il a été créé pour vous). 8 | -------------------------------------------------------------------------------- /missions/intermediate/02_alias_journal/treasure-msg/it.txt: -------------------------------------------------------------------------------- 1 | Complimenti! 2 | 3 | Da ora puoi utilizzare il file 4 | "~/.gshrc" 5 | per registrare gli alias. 6 | Altre informazioni possono essere 7 | trovate nel file (è stato creato per te). 8 | -------------------------------------------------------------------------------- /missions/intermediate/02_alias_journal/treasure.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | alias "$(gettext "journal")"="nano '$GSH_CHEST/$(gettext "journal").txt'" 4 | 5 | if [ ! -f "$GSH_HOME/.gshrc" ] 6 | then 7 | cp "$GSH_CONFIG/player.gshrc" "$GSH_HOME/.gshrc" 8 | fi 9 | 10 | if [ -f "$GSH_HOME/.gshrc" ] 11 | then 12 | . "$GSH_HOME/.gshrc" 13 | fi 14 | -------------------------------------------------------------------------------- /missions/intermediate/03_tab_spider_lair/ascii-art/baby-bat.txt: -------------------------------------------------------------------------------- 1 | _ ,_, _ 2 | / `'=) (='` \ 3 | /.-.-.\ /.-.-.\ 4 | ` " ` jgs 5 | -------------------------------------------------------------------------------- /missions/intermediate/03_tab_spider_lair/ascii-art/spider-queen.txt: -------------------------------------------------------------------------------- 1 | ( 2 | ) 3 | ( 4 | /\ .-"""-. /\ 5 | //\\/ ,,, \//\\ 6 | |/\| ,;;;;;, |/\| 7 | //\\\;-"""-;///\\ 8 | // \/ . \/ \\ 9 | (| ,-_| \ | / |_-, |) 10 | //`__\.-.-./__`\\ 11 | // /.-(() ())-.\ \\ 12 | (\ |) '---' (| /) 13 | ` (| |) ` 14 | \) (/ jgs 15 | -------------------------------------------------------------------------------- /missions/intermediate/03_tab_spider_lair/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | lair="$(find "$(eval_gettext '$GSH_HOME/Castle/Cellar')" -type d -name ".$(gettext "Lair_of_the_spider_queen")*")" 4 | cd "$lair" 5 | queen=$(find "$lair" -type f -name "*$(gettext "spider_queen")*") 6 | rm -f "$queen" 7 | unset lair queen 8 | gsh check 9 | -------------------------------------------------------------------------------- /missions/intermediate/03_tab_spider_lair/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | set +o noglob 4 | rm -f "$GSH_TMP/start_time" 5 | 6 | case $GSH_LAST_ACTION in 7 | check_true) 8 | ;; 9 | *) 10 | case "$(pwd -P)" in 11 | "$(eval_gettext '$GSH_HOME/Castle/Cellar')/.$(gettext "Lair_of_the_spider_queen")"*) 12 | cd "$(eval_gettext '$GSH_HOME/Castle/Cellar')" 13 | echo "$(gettext "You are back in the cellar.")" 14 | ;; 15 | esac 16 | rm -rf "$(eval_gettext '$GSH_HOME/Castle/Cellar')/.$(gettext "Lair_of_the_spider_queen")"* 17 | ;; 18 | esac 19 | 20 | 21 | -------------------------------------------------------------------------------- /missions/intermediate/03_tab_spider_lair/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_init() ( 4 | r1=$(random_string 16) 5 | r2=$(random_string 16) 6 | lair="$(eval_gettext '$GSH_HOME/Castle/Cellar')/.$(gettext "Lair_of_the_spider_queen") ${r1} ${r2}" 7 | mkdir -p "$lair" 8 | 9 | r1=$(random_string 16) 10 | r2=$(random_string 16) 11 | queen="${r1}_$(gettext "spider_queen")_$r2" 12 | sign_file "$MISSION_DIR/ascii-art/spider-queen.txt" "$lair/$queen" 13 | 14 | r1=$(random_string 16) 15 | r2=$(random_string 16) 16 | bat="${r1}_$(gettext "baby_bat")_$r2" 17 | sign_file "$MISSION_DIR/ascii-art/baby-bat.txt" "$lair/$bat" 18 | 19 | date +%s > "$GSH_TMP/start_time" 20 | ) 21 | 22 | set -o noglob 23 | _mission_init 24 | -------------------------------------------------------------------------------- /missions/intermediate/03_tab_spider_lair/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext "\$GSH_HOME/Castle/Cellar")" 4 | -------------------------------------------------------------------------------- /missions/intermediate/04_bg_xeyes/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | . alt_history_start.sh 4 | 5 | add_cmd "xeyes" 6 | add_cmd "xeyes &" 7 | xeyes & 8 | add_cmd gsh check 9 | ( sleep 1; kill -9 $(ps | grep xeyes | awk '{print $1}') 2>/dev/null )& 10 | gsh check 11 | 12 | . alt_history_stop.sh 13 | -------------------------------------------------------------------------------- /missions/intermediate/04_bg_xeyes/goal/en.txt: -------------------------------------------------------------------------------- 1 | Mission goal 2 | ============ 3 | 4 | As you are walking around the castle, you feel like you are 5 | being watched... Turn your head quickly enough and you may 6 | see one of the paintings' eyes following you. 7 | 8 | 1/ Run the ``xeyes`` command, and stop it. 9 | 2/ Run the ``xeyes`` command in the background. 10 | 11 | 12 | Useful commands 13 | =============== 14 | 15 | xeyes 16 | Open a window with 2 eyes that track your mouse. 17 | 18 | COMMAND & 19 | Run the command in the background. 20 | 21 | Control-c (also written ^c) 22 | Pressing Control and c at the same times interrupts the current command 23 | by sending the INT ("INTerrupt") signal to the process. 24 | -------------------------------------------------------------------------------- /missions/intermediate/04_bg_xeyes/goal/fr.txt: -------------------------------------------------------------------------------- 1 | Objectif 2 | ======== 3 | 4 | Pendant que vous vous promenez dans le chateau, vous avez 5 | l'impression qu'on vous observe... Si vous tournez la tête 6 | rapidement, vous verrez peut-être que les yeux d'une peinture vous 7 | suivent. 8 | 9 | 1/ Lancez la commande ``xeyes`` puis stoppez la. 10 | 2/ Lancez la commande ``xeyes`` en tâche de fond. 11 | 12 | 13 | Commandes utiles 14 | ================ 15 | 16 | xeyes 17 | Affiche deux yeux qui suivent le mouvement de la souris. 18 | 19 | COMMANDE & 20 | Lance la commande en tâche de fond. 21 | 22 | Contrôle-c (aussi noté ^c) 23 | Appuyer sur les touches Contrôle et c en même temps interrompt 24 | la commande en cours en envoyant le signal INT ("INTerrupt") au 25 | processus. 26 | -------------------------------------------------------------------------------- /missions/intermediate/04_bg_xeyes/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivi missione 2 | ============ 3 | 4 | Mentre stai camminando nel castello, hai la sensazione di 5 | essere osservato... Gira velocemente la testa e potrai vedere 6 | gli occhi di uno dei dipinti che ti seguono. 7 | 8 | 1/ Esegui il comando ``xeyes`` e fermalo. 9 | 2/ Esegui il comando ``xeyes`` in background. 10 | 11 | 12 | Comandi utili 13 | =============== 14 | 15 | xeyes 16 | Apre una finestra con 2 occhi che seguono il tuo mouse. 17 | 18 | COMMAND & 19 | Esegui il comando in background. 20 | 21 | Control-c 22 | Questa combinazione di tasti interrompe il comando corrente inviando 23 | il segnale "INT". 24 | -------------------------------------------------------------------------------- /missions/intermediate/04_bg_xeyes/gshrc: -------------------------------------------------------------------------------- 1 | # if the XAUTHORITY variable isn't defined, it defaults to ~/.Xauthority 2 | # since GameShell redefines HOME, the file won't be found. 3 | 4 | if [ -z "$XAUTHORITY" ] 5 | then 6 | export XAUTHORITY=$REAL_HOME/.Xauthority 7 | else 8 | export XAUTHORITY=${XAUTHORITY/~/$REAL_HOME} 9 | fi 10 | -------------------------------------------------------------------------------- /missions/intermediate/04_bg_xeyes/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | if [ -z "$DISPLAY" ]; then 4 | echo "$(eval_gettext "The variable DISPLAY is not defined. 5 | A running X server is required for mission \$MISSION_NAME.")" >&2 6 | false 7 | elif ! command -v xeyes >/dev/null; then 8 | echo "$(eval_gettext "The command 'xeyes' is required for mission \$MISSION_NAME. 9 | (Debian / Ubuntu: install package 'x11-apps')")" >&2 10 | false 11 | elif ! command -v ps >/dev/null; then 12 | echo "$(eval_gettext "The command 'ps' is required for mission \$MISSION_NAME. 13 | (Debian / Ubuntu: install package 'procps')")" >&2 14 | false 15 | else 16 | true 17 | fi 18 | -------------------------------------------------------------------------------- /missions/intermediate/04_bg_xeyes/skip/en.txt: -------------------------------------------------------------------------------- 1 | This mission is optionnal. You can skip it and go to the next one with the 2 | command 3 | 4 | $ gsh skip 5 | -------------------------------------------------------------------------------- /missions/intermediate/04_bg_xeyes/skip/fr.txt: -------------------------------------------------------------------------------- 1 | Cette mission est facultative. Vous pouvez l'ignorer et passer à la suivante 2 | avec la commande 3 | 4 | $ gsh skip 5 | -------------------------------------------------------------------------------- /missions/intermediate/04_bg_xeyes/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | . alt_history_start.sh 4 | 5 | add_cmd "xeyes" 6 | add_cmd "xeyes &" 7 | add_cmd gsh check 8 | gsh assert check false 9 | 10 | add_cmd "xeyes" 11 | add_cmd "xeyes &" 12 | add_cmd "something1" 13 | add_cmd "something2" 14 | add_cmd "something3" 15 | add_cmd "something4" 16 | add_cmd gsh check 17 | gsh assert check false 18 | 19 | add_cmd "xeyes &" 20 | add_cmd "xeyes" 21 | add_cmd gsh check 22 | gsh assert check false 23 | 24 | xeyes & 25 | add_cmd "xeyes &" 26 | add_cmd "xeyes" 27 | add_cmd gsh check 28 | gsh assert check true 29 | 30 | ps -e | awk '/xeyes/ {print $1}' | xargs kill -9 2> /dev/null 31 | 32 | . alt_history_stop.sh 33 | 34 | -------------------------------------------------------------------------------- /missions/intermediate/05_background/ascii-art/f1: -------------------------------------------------------------------------------- 1 | .:::. 2 | ::::: 3 | ':::' 4 | -------------------------------------------------------------------------------- /missions/intermediate/05_background/ascii-art/f2: -------------------------------------------------------------------------------- 1 | . 2 | _\(/_ 3 | ./)\ 4 | ' 5 | -------------------------------------------------------------------------------- /missions/intermediate/05_background/ascii-art/f3: -------------------------------------------------------------------------------- 1 | *''* 2 | *_\/_* 3 | * /\ * 4 | *..* 5 | -------------------------------------------------------------------------------- /missions/intermediate/05_background/ascii-art/f4: -------------------------------------------------------------------------------- 1 | : 2 | '.\'/.' 3 | -= o =- 4 | .'/.\'. 5 | : 6 | -------------------------------------------------------------------------------- /missions/intermediate/05_background/ascii-art/f5: -------------------------------------------------------------------------------- 1 | . 2 | .'.:.'. 3 | -=:o:=- 4 | '.':'.' 5 | ' 6 | -------------------------------------------------------------------------------- /missions/intermediate/05_background/ascii-art/f6: -------------------------------------------------------------------------------- 1 | .''. 2 | :_\/_: 3 | : /\ : 4 | '..' 5 | -------------------------------------------------------------------------------- /missions/intermediate/05_background/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # set -m 4 | 5 | flarigo & flarigo & flarigo & gsh check 6 | -------------------------------------------------------------------------------- /missions/intermediate/05_background/flarigo.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . gsh_gettext.sh 4 | 5 | command=$(gettext "flarigo") 6 | 7 | 8 | file="$MISSION_DIR/ascii-art/f$((1 + $(RANDOM)%6))" 9 | indent=$(echo " " | head -c "$((2 + 4 * ($(RANDOM)%8)))") 10 | 11 | rm -f "$GSH_TMP/flarigo.pids" 12 | for i in $(seq $((5 + $(RANDOM)%5))) 13 | do 14 | echo "$indent *" 15 | sleep 0.1 16 | done 17 | 18 | awk -v indent="$indent" '{print indent, $0}' < "$file" 19 | 20 | echo $$ >> "$GSH_TMP/flarigo.pids" 21 | 22 | sleep 1 23 | 24 | exit 0 25 | -------------------------------------------------------------------------------- /missions/intermediate/05_background/goal.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | command="$(gettext 'flarigo')" 4 | sed "s/\\\$command/$command/g" "$(eval_gettext '$MISSION_DIR/goal/en.txt')" 5 | unset command 6 | -------------------------------------------------------------------------------- /missions/intermediate/05_background/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_init() { 4 | copy_bin "$MISSION_DIR/flarigo.sh" "$GSH_BIN/$(gettext flarigo)" 5 | } 6 | _mission_init 7 | -------------------------------------------------------------------------------- /missions/intermediate/05_background/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # set -m 4 | 5 | gsh assert check false 6 | flarigo & gsh assert check false 7 | flarigo & flarigo & gsh assert check false 8 | flarigo & flarigo & flarigo & gsh assert check true 9 | flarigo & flarigo & flarigo & flarigo & gsh assert check true 10 | 11 | flarigo & flarigo & flarigo 12 | gsh assert check false 13 | 14 | flarigo; flarigo; flarigo 15 | gsh assert check false 16 | 17 | 18 | -------------------------------------------------------------------------------- /missions/intermediate/06_control-C/ascii-art/explosion.txt: -------------------------------------------------------------------------------- 1 | 2 | _.-^^---....,,-- 3 | _-- --_ 4 | < >) 5 | | | 6 | \._ _./ 7 | ```--. . , ; .--''' 8 | | | | 9 | .-=|| | |=-. 10 | `-=#$%&%$#=-' 11 | | ; :| 12 | _____.,-#%&$@%#&#~,._____ 13 | 14 | -------------------------------------------------------------------------------- /missions/intermediate/06_control-C/ascii-art/fireworks.txt: -------------------------------------------------------------------------------- 1 | 2 | .''. 3 | .''. . *''* :_\/_: . 4 | :_\/_: _\(/_ .:.*_\/_* : /\ : .'.:.'. 5 | .''.: /\ : ./)\ ':'* /\ * : '..'. -=:o:=- 6 | :_\/_:'.:::. ' *''* * '.\'/.' _\(/_'.':'.' 7 | : /\ : ::::: *_\/_* -= o =- /)\ ' * 8 | '..' ':::' * /\ * .'/.\'. ' 9 | * *..* : 10 | * 11 | * 12 | -------------------------------------------------------------------------------- /missions/intermediate/06_control-C/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # set -m 4 | 5 | for c in a b c d e f 6 | do 7 | eval "$(gettext charmiglio) $c$c$c$c &" 2>/dev/null 8 | PID=$! 9 | sleep 4 10 | # NOTE: SIGINT signal doesn't work on non-interactive systems 11 | kill "$PID" 2> /dev/null 12 | 13 | case "$(cat "$GSH_TMP/control-C")" in 14 | *[!0-9]*) 15 | break 16 | ;; 17 | *) 18 | : 19 | ;; 20 | esac 21 | done 22 | 23 | gsh check < "$GSH_TMP/control-C" 24 | 25 | 26 | -------------------------------------------------------------------------------- /missions/intermediate/06_control-C/check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_check() { 4 | r=$(cat "$GSH_TMP/control-C") 5 | printf "%s " "$(gettext "What's a valid 4 letters sequence?")" 6 | read -r n 7 | 8 | case "$r" in 9 | *[!a-zA-Z]*) 10 | return 1 11 | ;; 12 | ????) 13 | if [ "$n" = "$r" ] 14 | then 15 | return 0 16 | else 17 | return 1 18 | fi 19 | ;; 20 | *) 21 | return 1 22 | esac 23 | } 24 | _mission_check 25 | -------------------------------------------------------------------------------- /missions/intermediate/06_control-C/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | rm -f "$GSH_TMP/control-C*" 4 | -------------------------------------------------------------------------------- /missions/intermediate/06_control-C/goal.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | command="$(gettext 'charmiglio')" 4 | sed "s/\\\$command/$command/g" "$(eval_gettext '$MISSION_DIR/goal/en.txt')" 5 | unset command 6 | -------------------------------------------------------------------------------- /missions/intermediate/06_control-C/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_init() { 4 | # nb of tries to make 5 | echo $((2 + $(RANDOM) % 3)) > "$GSH_TMP/control-C" 6 | rm -f "$GSH_TMP/control-C.codes" 7 | 8 | copy_bin "$MISSION_DIR/charmiglio.sh" "$GSH_BIN/$(gettext charmiglio)" 9 | } 10 | _mission_init 11 | -------------------------------------------------------------------------------- /missions/intermediate/06_control-C/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # set -m 4 | 5 | do_test() { 6 | nb=$1 7 | delay=$2 8 | 9 | for c in $(echo "a b c d e f g h i j" | cut -d' ' -f1-$nb) 10 | do 11 | eval "$(gettext charmiglio) $c$c$c$c &" 2>/dev/null 12 | PID=$! 13 | sleep "$delay" 14 | # NOTE: SIGINT signal doesn't work on non-interactive systems 15 | kill "$PID" 2> /dev/null 16 | 17 | case "$(cat "$GSH_TMP/control-C")" in 18 | *[!0-9]*) 19 | break 20 | ;; 21 | *) 22 | : 23 | ;; 24 | esac 25 | done 26 | } 27 | 28 | do_test 10 0.3 29 | gsh assert check false < "$GSH_TMP/control-C" 30 | 31 | do_test 2 4 32 | gsh assert check false < "$GSH_TMP/control-C" 33 | 34 | do_test 6 4 35 | gsh assert check true < "$GSH_TMP/control-C" 36 | -------------------------------------------------------------------------------- /missions/intermediate/default.idx: -------------------------------------------------------------------------------- 1 | 01_alias_la 2 | 02_alias_journal 3 | 03_tab_spider_lair 4 | 04_bg_xeyes 5 | 05_background 6 | 06_control-C 7 | -------------------------------------------------------------------------------- /missions/misc/01_cal_nostradamus/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | rm -f "$GSH_TMP"/date 4 | -------------------------------------------------------------------------------- /missions/misc/01_cal_nostradamus/goal.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | YYYY=$(cut -d"-" -f1 "$GSH_TMP"/date) 4 | MM=$(cut -d"-" -f2 "$GSH_TMP"/date) 5 | DD=$(cut -d"-" -f3 "$GSH_TMP"/date) 6 | sed -e "s/\\\$YYYY/$YYYY/g" \ 7 | -e "s/\\\$MM/$MM/g" \ 8 | -e "s/\\\$DD/$DD/g" \ 9 | "$(eval_gettext '$MISSION_DIR/goal/en.txt')" 10 | unset YYYY MM DD 11 | -------------------------------------------------------------------------------- /missions/misc/01_cal_nostradamus/goal/en.txt: -------------------------------------------------------------------------------- 1 | Mission goal 2 | ============ 3 | 4 | Nostradamus predicted a spectacular star conjunction on the 5 | $MM-$DD-$YYYY. 6 | But what will the day of the week be on that date? 7 | 8 | When you have it, run the command ``gsh check``. 9 | 10 | 11 | Useful commands 12 | =============== 13 | 14 | cal 15 | Print a calendar for the current month. 16 | 17 | cal YEAR 18 | Print a calendar for the given year. 19 | -------------------------------------------------------------------------------- /missions/misc/01_cal_nostradamus/goal/fr.txt: -------------------------------------------------------------------------------- 1 | Objectif 2 | ======== 3 | 4 | Nostradamus a prévu une conjonction spectaculaire des astres pour 5 | le $DD-$MM-$YYYY. 6 | Mais sur quel jour de la semaine tombera donc cette date ? 7 | 8 | Lorsque vous le connaissez, lancez la commande ``gsh check``. 9 | 10 | 11 | Commandes utiles 12 | ================ 13 | 14 | cal 15 | Affiche un petit calendrier du mois courant. 16 | 17 | cal ANNEE 18 | Affiche un petit calendrier pour l'année donnée. 19 | -------------------------------------------------------------------------------- /missions/misc/01_cal_nostradamus/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivi Missione 2 | ============ 3 | 4 | Nostradamus ha predetto una spettacolare congiunzione stellare il 5 | $MM-$DD-$YYYY. 6 | Però quale sarà il giorno della settimana? 7 | 8 | Quando lo hai scoperto, esegui il comando ``gsh check``. 9 | 10 | 11 | Comandi utili 12 | =============== 13 | 14 | cal 15 | Stampa un calendario per il mese attuale. 16 | 17 | cal ANNO 18 | Stampa un calendario per quell'anno. 19 | -------------------------------------------------------------------------------- /missions/misc/01_cal_nostradamus/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_init() ( 4 | if ! command -v cal >/dev/null; then 5 | echo "$(eval_gettext "The command 'cal' is required for mission \$MISSION_NAME. 6 | (Debian / Ubuntu: install package 'ncal')")" >&2 7 | return 1 8 | fi 9 | # keep the date between 1902 and 2038 to avoid problems with 32bits systems 10 | YYYY=$((1902 + $(RANDOM) % 136)) 11 | MM=$(printf "%02d" "$((1 + $(RANDOM) % 12))") 12 | # keep the day strictly above 12, to avoid confusing day/month 13 | DD=$(printf "%02d" "$((13 + $(RANDOM) % 15))") 14 | echo "$YYYY-$MM-$DD" > "$GSH_TMP/date" 15 | ) 16 | 17 | _mission_init 18 | -------------------------------------------------------------------------------- /missions/misc/01_cal_nostradamus/skip/en.txt: -------------------------------------------------------------------------------- 1 | This mission is optionnal. You can skip it and go to the next one with the 2 | command 3 | 4 | $ gsh skip 5 | -------------------------------------------------------------------------------- /missions/misc/01_cal_nostradamus/skip/fr.txt: -------------------------------------------------------------------------------- 1 | Cette mission est facultative. Vous pouvez l'ignorer et passer à la suivante 2 | avec la commande 3 | 4 | $ gsh skip 5 | -------------------------------------------------------------------------------- /missions/misc/02_nano_journal/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$GSH_CHEST" 4 | echo "I'll be back." > "$GSH_CHEST/$(gettext "journal").txt" 5 | gsh check 6 | -------------------------------------------------------------------------------- /missions/misc/02_nano_journal/check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_check() ( 4 | journal_file="$GSH_CHEST/$(gettext "journal").txt" 5 | if [ ! -f "$journal_file" ] 6 | then 7 | journal=~${journal#$GSH_ROOT} 8 | echo "$(eval_gettext "The file '\$journal_file' doesn't exist...")" 9 | find "$GSH_HOME" -iname "*$(gettext "journal")*" -print0 | xargs -0 rm -f 10 | return 1 11 | elif [ ! -s "$journal_file" ] 12 | then 13 | journal=~${journal#$GSH_ROOT} 14 | echo "$(eval_gettext "The file '\$journal_file' is empty...")" 15 | find "$GSH_HOME" -iname "*$(gettext "journal")*" -print0 | xargs -0 rm -f 16 | return 1 17 | else 18 | return 0 19 | fi 20 | ) 21 | 22 | _mission_check 23 | -------------------------------------------------------------------------------- /missions/misc/02_nano_journal/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | if ! command -v nano >/dev/null; then 4 | echo "$(eval_gettext "The command 'nano' is required for mission \$MISSION_NAME. 5 | (Debian / Ubuntu: install package 'nano')")" >&2 6 | false 7 | else 8 | [ -z "$GSH_CHEST" ] && GSH_CHEST="$(eval_gettext '$GSH_HOME/Forest/Hut/Chest')" 9 | mkdir -p "$GSH_CHEST" 10 | fi 11 | -------------------------------------------------------------------------------- /missions/misc/02_nano_journal/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | rm -f "$GSH_CHEST/$(gettext "journal").txt" 4 | gsh assert check false 5 | 6 | touch "$GSH_CHEST/$(gettext "journal").txt" 7 | gsh assert check false 8 | 9 | echo "TEST" > "$GSH_CHEST/$(gettext "journal").txt" 10 | gsh assert check true 11 | 12 | rm -f "$GSH_CHEST/$(gettext "journal").txt" 13 | -------------------------------------------------------------------------------- /missions/misc/03_tr_caesar_shift/ascii-art/bottle.txt: -------------------------------------------------------------------------------- 1 | _________ 2 | [_________] 3 | | .-. | 4 | |,(o.o).| 5 | | >|n|< | 6 | |` `"` `| 7 | |POISON!| 8 | jgs `"""""""` 9 | -------------------------------------------------------------------------------- /missions/misc/03_tr_caesar_shift/ascii-art/ink_scroll.txt: -------------------------------------------------------------------------------- 1 | (\ 2 | \'\ 3 | \'\ __________ 4 | / '| ()_________) 5 | \ '/ \ ~~~~~~~~ \ 6 | \ \ ~~~~~~ \ 7 | ==). \__________\ 8 | (__) ()__________) 9 | 10 | -------------------------------------------------------------------------------- /missions/misc/03_tr_caesar_shift/ascii-art/medal.txt: -------------------------------------------------------------------------------- 1 | _______________ 2 | |@@@@| |####| 3 | |@@@@| |####| 4 | |@@@@| |####| 5 | \@@@@| |####/ 6 | \@@@| |###/ 7 | `@@|_____|##' 8 | (O) 9 | .-'''''-. 10 | .' * * * `. 11 | : * * : 12 | : ~ B E S T ~ : 13 | : ~ WIZZARD ~ : 14 | : * * : 15 | jgs `. * * * .' 16 | `-.....-' 17 | 18 | -------------------------------------------------------------------------------- /missions/misc/03_tr_caesar_shift/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | gsh check < "$GSH_TMP/magic_word" 4 | -------------------------------------------------------------------------------- /missions/misc/03_tr_caesar_shift/check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | echo "$(gettext "What's the key that will make Merlin's chest to appear?")" 4 | read -r dcode 5 | 6 | if [ "$dcode" = "$(cat "$GSH_TMP/magic_word")" ] 7 | then 8 | merlin_chest=$(eval_gettext '$GSH_HOME/Castle/Main_building/Library/Merlin_s_office')/$(gettext 'Merlin_s_chest') 9 | mkdir -p "$merlin_chest" 10 | cp "$(eval_gettext '$MISSION_DIR/secret_recipe/en.txt')" "$merlin_chest/$(gettext 'secret_recipe')" 11 | sign_file "$MISSION_DIR/ascii-art/medal.txt" "$merlin_chest/$(gettext 'medal')" 12 | sign_file "$MISSION_DIR/ascii-art/bottle.txt" "$merlin_chest/$(gettext 'bottle')" 13 | unset merlin_chest dcode 14 | true 15 | else 16 | echo "$(gettext "That's not the magic word.")" 17 | unset dcode 18 | false 19 | fi 20 | 21 | -------------------------------------------------------------------------------- /missions/misc/03_tr_caesar_shift/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | rm -f "$GSH_TMP/magic_word" 4 | -------------------------------------------------------------------------------- /missions/misc/03_tr_caesar_shift/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext '$GSH_HOME/Castle/Main_building/Library/Merlin_s_office/Drawer')" 4 | sign_file "$MISSION_DIR/ascii-art/ink_scroll.txt" "$(eval_gettext '$GSH_HOME/Castle/Main_building/Library/Merlin_s_office/Drawer')/$(gettext "ink_and_scroll")" 5 | -------------------------------------------------------------------------------- /missions/misc/default.idx: -------------------------------------------------------------------------------- 1 | 01_cal_nostradamus 2 | 02_nano_journal 3 | 03_tr_caesar_shift 4 | -------------------------------------------------------------------------------- /missions/permissions/01_chmod_x_dir_king_quarter/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | chmod +x "$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room/Kings_quarter')" 4 | cd "$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room/Kings_quarter')" 5 | gsh check 6 | -------------------------------------------------------------------------------- /missions/permissions/01_chmod_x_dir_king_quarter/check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | dir=$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room/Kings_quarter') 4 | 5 | if [ "$(readlink-f "$(pwd)" 2>/dev/null)" = "$(readlink-f "$dir" 2>/dev/null)" ] 6 | then 7 | unset dir 8 | true 9 | else 10 | echo "$(gettext "You are not in the King's quarter!")" 11 | unset dir 12 | false 13 | fi 14 | -------------------------------------------------------------------------------- /missions/permissions/01_chmod_x_dir_king_quarter/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | king_quarter=$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room/Kings_quarter') 4 | 5 | case "$GSH_LAST_ACTION" in 6 | "check_true") 7 | : 8 | ;; 9 | *) 10 | _PWD="$(readlink-f $(pwd) 2>/dev/null)" 11 | if [ -n "$_PWD" ] && [ "$_PWD" = "$(readlink-f "$king_quarter" 2>/dev/null)" ] 12 | then 13 | cd .. 14 | fi 15 | unset _PWD 16 | ;; 17 | esac 18 | 19 | # avoid problems when making a tar archive 20 | chmod +x "$king_quarter" 21 | unset king_quarter 22 | -------------------------------------------------------------------------------- /missions/permissions/01_chmod_x_dir_king_quarter/goal/en.txt: -------------------------------------------------------------------------------- 1 | Mission goal 2 | ============ 3 | 4 | The door to the King's quarter is in the throne room. 5 | Go to the King's quarter. 6 | 7 | Remark 8 | ------ 9 | 10 | Access to this part of the castle is probably restricted. 11 | 12 | 13 | Useful commands 14 | =============== 15 | 16 | ls -l 17 | List the files with their important meta-data. 18 | 19 | Access permissions are listed first on each line. 20 | 21 | chmod [OPTIONS] FILE 22 | Modify the permissions for the file (or directory). 23 | 24 | Refer to the manual to discover which options are available. 25 | -------------------------------------------------------------------------------- /missions/permissions/01_chmod_x_dir_king_quarter/goal/fr.txt: -------------------------------------------------------------------------------- 1 | Objectif 2 | ======== 3 | 4 | L'accès aux quartiers du roi se trouve dans la salle du trône. 5 | Rendez vous dans la chambre du roi. 6 | 7 | Remarque 8 | -------- 9 | 10 | Il est probable que l'accès à cette partie du château vous soit 11 | interdite. 12 | 13 | 14 | Commandes utiles 15 | ================ 16 | 17 | chmod [OPTIONS] FICHIER 18 | Modifie les droits d'accès à un fichier ou répertoire. 19 | Consultez le début de la page de manuel pour découvrir comment 20 | spécifier les droit d'accès. 21 | 22 | ls -l 23 | Affiche la liste des fichiers avec leurs métadonnées importantes. 24 | Les droits d'accès sont donnés en début de ligne. 25 | 26 | -------------------------------------------------------------------------------- /missions/permissions/01_chmod_x_dir_king_quarter/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivo Missione 2 | ============ 3 | 4 | La porta per il quartiere dei Re è nella sala del trono. 5 | Vai nel quartiere dei Re. 6 | 7 | Attenzione 8 | ------ 9 | 10 | L'accesso a questa parte del castello è probabilmente limitata. 11 | 12 | 13 | Comandi 14 | =============== 15 | 16 | ls -l 17 | Elenca i file con i loro metadati importanti. 18 | 19 | I permessi di accesso sono elencati per primi in ogni riga. 20 | 21 | chmod [OPZIONI] FILE 22 | Modifica i permessi del file (o cartella). 23 | 24 | Fai riferimento al manuale per scoprire quali opzioni sono disponibili. 25 | -------------------------------------------------------------------------------- /missions/permissions/01_chmod_x_dir_king_quarter/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_init() ( 4 | if ! command -v man >/dev/null; then 5 | echo "$(eval_gettext "The command 'man' is required for mission \$MISSION_NAME. 6 | (Debian / Ubuntu: install package 'man-db')")" >&2 7 | return 1 8 | fi 9 | 10 | [ "$(readlink-f "$(pwd)")" = "$(readlink-f "$dir")" ] && cd .. 11 | 12 | dir=$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room/Kings_quarter') 13 | chmod -x "$dir" 14 | 15 | return 0 16 | ) 17 | 18 | _mission_init 19 | -------------------------------------------------------------------------------- /missions/permissions/01_chmod_x_dir_king_quarter/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room/Kings_quarter')" 4 | -------------------------------------------------------------------------------- /missions/permissions/01_chmod_x_dir_king_quarter/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | gsh assert check false 4 | 5 | chmod +x "$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room/Kings_quarter')" 6 | cd "$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room/Kings_quarter')" 7 | gsh assert check true 8 | 9 | cd 10 | gsh assert check false 11 | -------------------------------------------------------------------------------- /missions/permissions/02_chmod_r_file_king_quarter/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | dir=$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room/Kings_quarter') 4 | chmod +r "$dir/.$(gettext "secret_note")" 5 | gsh check < "$dir/.$(gettext "secret_note")" 6 | unset dir 7 | -------------------------------------------------------------------------------- /missions/permissions/02_chmod_r_file_king_quarter/check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | printf "%s " "$(gettext "What's the combination to open the King's safe?")" 4 | read -r key 5 | real_key=$(cat "$GSH_TMP/key") 6 | 7 | if [ "$key" = "$real_key" ] 8 | then 9 | unset key real_key 10 | true 11 | else 12 | echo "$(gettext "That's not the real combination!")" 13 | unset key real_key 14 | false 15 | fi 16 | -------------------------------------------------------------------------------- /missions/permissions/02_chmod_r_file_king_quarter/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # avoid problems when making a tar archive 4 | chmod +r "$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room/Kings_quarter')/.$(gettext "secret_note")" 5 | rm -f "$GSH_TMP/key" 6 | 7 | -------------------------------------------------------------------------------- /missions/permissions/02_chmod_r_file_king_quarter/goal/en.txt: -------------------------------------------------------------------------------- 1 | Mission goal 2 | ============ 3 | 4 | The King is rumored to keep the combination to his safe written on a 5 | note in his room. 6 | Find that combination. 7 | 8 | Remark 9 | ------ 10 | 11 | The King probably tried to make this note unreadable! 12 | 13 | 14 | Useful commands 15 | =============== 16 | 17 | ls -l 18 | Lists the files with their important meta-data. 19 | 20 | Access permissions are listed first on each line. 21 | 22 | chmod [OPTIONS] FILE 23 | Modifies the permissions for the file (or directory). 24 | 25 | Refer to the manual to discover which options are available. 26 | 27 | -------------------------------------------------------------------------------- /missions/permissions/02_chmod_r_file_king_quarter/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivo Missione 2 | ============ 3 | 4 | Si dice che il Re abbia scritto la combinazione della sua cassaforte 5 | in un biglietto nella sua stanza. 6 | Trova quella combinazione. 7 | 8 | Attenzione 9 | ------ 10 | 11 | Il Re ha probabilmente provato a rendere il biglietto illeggibile! 12 | 13 | 14 | Comandi utili 15 | =============== 16 | 17 | ls -l 18 | Elenca i file con i loro metadati importanti. 19 | 20 | I permessi di accesso sono elencati per primi in ogni riga. 21 | 22 | chmod [OPZIONI] FILE 23 | Modifica i permessi del file (o cartella). 24 | 25 | Fai riferimento al manuale per scoprire quali opzioni sono disponibili. 26 | 27 | -------------------------------------------------------------------------------- /missions/permissions/02_chmod_r_file_king_quarter/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_init() ( 4 | if ! command -v man >/dev/null; then 5 | echo "$(eval_gettext "The command 'man' is required for mission \$MISSION_NAME. 6 | (Debian / Ubuntu: install package 'man-db')")" >&2 7 | return 1 8 | fi 9 | 10 | dir=$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room/Kings_quarter') 11 | key=$(RANDOM)$(RANDOM) 12 | echo "$key" > "$GSH_TMP/key" 13 | echo "$key" > "$dir/.$(gettext "secret_note")" 14 | echo "0123456789" > "$dir/$(gettext "note")" 15 | chmod -r "$dir/.$(gettext "secret_note")" 16 | ) 17 | 18 | _mission_init 19 | -------------------------------------------------------------------------------- /missions/permissions/02_chmod_r_file_king_quarter/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room/Kings_quarter')" 4 | -------------------------------------------------------------------------------- /missions/permissions/02_chmod_r_file_king_quarter/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | dir=$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room/Kings_quarter') 4 | chmod +r "$dir/.$(gettext "secret_note")" 5 | gsh assert check true < "$dir/.$(gettext "secret_note")" 6 | 7 | dir=$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room/Kings_quarter') 8 | gsh assert check false < "$dir/$(gettext "note")" 9 | 10 | unset dir 11 | -------------------------------------------------------------------------------- /missions/permissions/03_chmod_rw_file_dir_throne_room/ascii-art/crown.txt: -------------------------------------------------------------------------------- 1 | _.+._ jgs 2 | (^\/^\/^) 3 | \@*@*@/ 4 | {_KEY_} 5 | -------------------------------------------------------------------------------- /missions/permissions/03_chmod_rw_file_dir_throne_room/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | safedir="$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room')/$(gettext "Safe")" 4 | chmod 755 "$safedir" 5 | chmod 644 "$safedir/$(gettext "crown")" 6 | mv "$safedir/$(gettext "crown")" "$GSH_CHEST" 7 | 8 | key=$(tail -n 1 "$GSH_CHEST/$(gettext "crown")" | cut -c 4-6) 9 | 10 | echo "$key" | gsh check 11 | 12 | unset safedir key 13 | -------------------------------------------------------------------------------- /missions/permissions/03_chmod_rw_file_dir_throne_room/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | safe="$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room')/$(gettext "Safe")" 4 | 5 | case "$GSH_LAST_ACTION" in 6 | "check_true") 7 | : 8 | ;; 9 | *) 10 | _PWD="$(readlink-f $(pwd) 2>/dev/null)" 11 | if [ -n "$_PWD" ] && [ "$_PWD" = "$(readlink-f "$safe" 2>/dev/null)" ] 12 | then 13 | cd "$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room')" 14 | fi 15 | unset _PWD 16 | ;; 17 | esac 18 | 19 | # avoid problems when making a tar archive 20 | chmod 755 "$safe" 21 | chmod -f 644 "$safe/$(gettext "crown")" 2>/dev/null 22 | rm -f "$GSH_TMP/crown" 23 | unset safe 24 | -------------------------------------------------------------------------------- /missions/permissions/03_chmod_rw_file_dir_throne_room/goal/en.txt: -------------------------------------------------------------------------------- 1 | Mission goal 2 | ============ 3 | 4 | The safe in the throne room contains the king's crown. 5 | Steal it and store it in your chest. 6 | 7 | Also, the base of the crown is inscribed with a magical sequence of 8 | digits. Look at those digits and remember them. 9 | 10 | 11 | Useful commands 12 | =============== 13 | 14 | ls -l 15 | List the files with their important meta-data. 16 | 17 | Access permissions are listed first on each line. 18 | 19 | chmod [OPTIONS] FILE 20 | Modify the permissions for the file (or directory). 21 | 22 | Refer to the manual to discover which options are available. 23 | -------------------------------------------------------------------------------- /missions/permissions/03_chmod_rw_file_dir_throne_room/goal/fr.txt: -------------------------------------------------------------------------------- 1 | Objectif 2 | ======== 3 | 4 | Le coffre-fort dans la salle du trône contient la couronne du roi. 5 | Vous devez la dérober et la stocker dans votre coffre. 6 | 7 | De plus, une séquence magique de 3 chiffres est inscrite au bas de 8 | la couronne. Regardez ces chiffres et souvenez vous en. 9 | -------------------------------------------------------------------------------- /missions/permissions/03_chmod_rw_file_dir_throne_room/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivo Missione 2 | ============ 3 | 4 | La cassaforte nella sala del trono contiene la corona del Re. 5 | Rubala e conservala nella tua cassa. 6 | 7 | Inoltre, la base della corona è incisa con una serie magica di numeri. 8 | Osservali e ricordali. 9 | 10 | 11 | Comandi utili 12 | =============== 13 | 14 | ls -l 15 | Elenca i file con i loro metadati importanti. 16 | 17 | I permessi di accesso sono elencati per primi in ogni riga. 18 | 19 | chmod [OPZIONI] FILE 20 | Modifica i permessi del file (o cartella). 21 | 22 | Fai riferimento al manuale per scoprire quali opzioni sono disponibili. 23 | 24 | -------------------------------------------------------------------------------- /missions/permissions/03_chmod_rw_file_dir_throne_room/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | [ -z "$GSH_CHEST" ] && GSH_CHEST="$(eval_gettext '$GSH_HOME/Forest/Hut/Chest')" 4 | mkdir -p "$GSH_CHEST" 5 | 6 | safe="$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room')/$(gettext "Safe")" 7 | mkdir -p "$safe" 8 | chmod 755 "$safe" 9 | chmod 644 "$safe/$(gettext "crown")" 2> /dev/null 10 | k=$(printf "%03d" "$(($(RANDOM) % 1000))") 11 | 12 | sed "s/KEY/$k/" "$MISSION_DIR/ascii-art/crown.txt" > "$safe/$(gettext "crown")" 13 | 14 | cp "$safe/$(gettext "crown")" "$GSH_TMP"/crown 15 | 16 | chmod 000 "$safe/$(gettext "crown")" 17 | chmod 000 "$safe" 18 | 19 | unset safe k 20 | 21 | -------------------------------------------------------------------------------- /missions/permissions/03_chmod_rw_file_dir_throne_room/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext '$GSH_HOME/Castle/Main_building/Throne_room')" 4 | -------------------------------------------------------------------------------- /missions/permissions/default.idx: -------------------------------------------------------------------------------- 1 | 01_chmod_x_dir_king_quarter 2 | 02_chmod_r_file_king_quarter 3 | 03_chmod_rw_file_dir_throne_room 4 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/00_shared/ascii-art/cauldron.txt: -------------------------------------------------------------------------------- 1 | 2 | ( 3 | ) ) 4 | ______(____ 5 | (___________) 6 | / \ 7 | / \ 8 | | | 9 | ____\ /____ 10 | ()____'.__ __.'____() 11 | jgs .'` .'```'. `-. 12 | ().'` `'.() 13 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/00_shared/ascii-art/servillus.txt: -------------------------------------------------------------------------------- 1 | . 2 | /^\ . 3 | /\ `V' 4 | /__\ I O o 5 | //..\\ I . 6 | \].`[/ I 7 | /l\/j\ (] . O 8 | /. ~~ ,\/I . 9 | \\L__j^\/I o 10 | \/--v} I o . 11 | | | I _________ 12 | | | I c(` ')o 13 | | l I \. ,/ 14 | _/j L l\_I _//^---^\\_ Row 15 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 16 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/00_shared/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | rm -f "$(eval_gettext '$GSH_HOME/Mountain/Cave')/servillus" 4 | sign_file "$MISSION_DIR/ascii-art/cauldron.txt" "$(eval_gettext '$GSH_HOME/Mountain/Cave')/$(gettext "cauldron")" 5 | 6 | rm -rf "$GSH_TMP/book_of_potions" 7 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/00_shared/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext '$GSH_HOME/Mountain/Cave')" 4 | sign_file "$MISSION_DIR/ascii-art/cauldron.txt" "$(eval_gettext '$GSH_HOME/Mountain/Cave')/$(gettext "cauldron")" 5 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/00_shared/torn_page5/en.txt: -------------------------------------------------------------------------------- 1 | /ilter of love 2 | /-------------- 3 | / 4 | |1) Put 10 sliced oranges in a warm cauldron. 5 | \2) Add 1 bottle of red wine. 6 | /3) Add 13 spoons of sugar. 7 | \4) Add 5 cloves and 1 cinnamon stick. 8 | /5) Add 2 star anises. 9 | \6) Also add 3 slices of fresh (peeled) ginger. 10 | \) Warm the preparation gently for half an hour. 11 | /) Add in some strong brandy. 12 | /9) Pour into glasses and serve warm. 13 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/00_shared/torn_page5/fr.txt: -------------------------------------------------------------------------------- 1 | /iltre d'amour 2 | /-------------- 3 | / 4 | |1) Mettre 10 oranges tranchées dans un chaudron chaud. 5 | \2) Ajouter 1 bouteille de vin rouge. 6 | /3) Ajouter 14 cuillères de sucre. 7 | \4) Ajouter 5 clous de girofles et 1 bâton de cannelle. 8 | /5) Ajouter 2 anis étoilés. 9 | \6) Ajouter aussi 3 tranches de gingembre frais (pelé). 10 | \) Faire chauffer la préparation doucement une demi-heure. 11 | /) Ajouter un peu d'eau de vie. 12 | /9) Verser dans de verres, et servir chaud. 13 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/00_shared/torn_page5/it.txt: -------------------------------------------------------------------------------- 1 | /iltro d'amore 2 | /-------------- 3 | / 4 | |1) Metti 10 arance tagliate in un calderone caldo. 5 | \2) Aggiungi 1 bottiglia di vino rosso. 6 | /3) Aggiungi 13 cucchiai di zucchero. 7 | \4) Aggiungi 5 chiodi di garofano e 1 bastoncino di cannella. 8 | /5) Aggiungi 2 anici stellati. 9 | \6) Aggiungi 3 fette di zenzero pelato fresco. 10 | \) Riscalda il preparato gentilmente per mezz'ora. 11 | /) Aggiungi del brandy forte. 12 | /9) Versa in dei biccheri e servi caldo. 13 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/00_shared/torn_page6/en.txt: -------------------------------------------------------------------------------- 1 | /tled fear 2 | /---------- 3 | _/ 4 | \1) Grab an old, dusty wine bottle and a cork. 5 | /2) Ready a few scary rats and spiders in a trunk. 6 | \3) Invite a friend for a nice cup of herbal tea. 7 | /4) Serve the tea on the trunk, and be pleasant. 8 | |5) Also have some biscuits (optional). 9 | \6) When your friend least expects it, open the trunk! 10 | /7) Capture the scream of your victim in the bottle. 11 | \8) Quickly add the cork while it still resonates. 12 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/00_shared/torn_page6/fr.txt: -------------------------------------------------------------------------------- 1 | /t en bouteille 2 | /--------------- 3 | _/ 4 | \1) Prendre une vielle bouteille poussiéreuse et un bouchon. 5 | /2) Mettre des rats et araignées terrifiantes dans une malle. 6 | \3) Inviter un ami pour boire un bol de thé aux herbes. 7 | /4) Servir le thé sur la malle, et détendre votre invité. 8 | |5) Proposer quelques biscuits à votre invité (facultatif). 9 | \6) Quand il s'y attend le moins, ouvrir la malle ! 10 | /7) Capturer le cri de votre victime dans la bouteille. 11 | \8) Ajouter le bouchon rapidement, avant la fin du cri. 12 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/00_shared/torn_page6/it.txt: -------------------------------------------------------------------------------- 1 | /paura in bottiglia 2 | /---------- 3 | _/ 4 | \1) Prendi una vecchia polverosa bottiglia di vino e del sughero. 5 | /2) Prepara alcuni paurosi topi e ragni in un tronco. 6 | \3) Invita un amico per un tè d'erbe. 7 | /4) Servi il tè sul tronco, e sii piacevole. 8 | |5) Se vuoi aggiungi dei biscotti (facoltativo). 9 | \6) Quando il tuo amico meno se lo aspetta, apri il tronco! 10 | /7) Cattura l'urlo della tua vittima nella bottiglia. 11 | \8) Tappa velocemente la bottiglia con il sughero finchè ancora risuona. 12 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/01_head/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | . alt_history_start.sh 4 | 5 | cd "$(eval_gettext '$GSH_HOME/Mountain/Cave')" 6 | 7 | # commands from a sourced file aren't saved in the history, 8 | # we need to do that explicitly 9 | add_cmd head -n 6 "$(gettext "Book_of_potions")/$(gettext "page")_07" 10 | add_cmd gsh check 11 | gsh check 12 | 13 | . alt_history_stop.sh 14 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/01_head/clean.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/clean.sh -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/01_head/i18n/template.pot: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 3 | "Content-Transfer-Encoding: 8bit\n" 4 | 5 | #, sh-format 6 | msgid "$GSH_HOME/Mountain/Cave" 7 | msgstr "" 8 | 9 | # path for the text file containing the goal 10 | #, sh-format 11 | msgid "$MISSION_DIR/goal/en.txt" 12 | msgstr "" 13 | 14 | msgid "Book_of_potions" 15 | msgstr "" 16 | 17 | msgid "You altered the book..." 18 | msgstr "" 19 | 20 | msgid "You are not in the cave with Servillus!" 21 | msgstr "" 22 | 23 | msgid "You have not used the 'head' command!" 24 | msgstr "" 25 | 26 | msgid "Your previous command does not give the expected result..." 27 | msgstr "" 28 | 29 | msgid "page" 30 | msgstr "" 31 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/01_head/init.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/init.sh -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/01_head/static.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/static.sh -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/02_tail/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | . alt_history_start.sh 4 | 5 | cd "$(eval_gettext '$GSH_HOME/Mountain/Cave')" 6 | 7 | # commands from a sourced file aren't saved in the history, 8 | # we need to do that explicitly 9 | add_cmd tail -n 9 "$(gettext "Book_of_potions")/$(gettext "page")_12" 10 | add_cmd gsh check 11 | gsh check 12 | 13 | . alt_history_stop.sh 14 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/02_tail/clean.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/clean.sh -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/02_tail/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivi missione 2 | ================== 3 | 4 | L'uomo anziano sembra gradire assai la tua compagnia. Ti invita a 5 | rimanere per cena, e inzia a preparare un delizioso stufato per entrambi. 6 | Mentre prepara il calderone, chiede il tuo aiuto. 7 | 8 | Leggi i passi della ricetta dal suo libro. 9 | 10 | Per rendere la missione valida, devi essere nella grotta con Servillus 11 | **e** il tuo ultimo comando prima di ``gsh check`` deve visualizzare i 12 | passi della ricetta (escluso il titolo). 13 | 14 | Comandi utili 15 | ------------- 16 | 17 | cat FILE 18 | Visualizza i contenuti del file. 19 | 20 | tail FILE 21 | Visualizza le ultime 10 righe del file. 22 | 23 | tail -n K FILE 24 | Visualizza le ultime K righe del file. 25 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/02_tail/i18n/template.pot: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 3 | "Content-Transfer-Encoding: 8bit\n" 4 | 5 | #, sh-format 6 | msgid "$GSH_HOME/Mountain/Cave" 7 | msgstr "" 8 | 9 | # path for the text file containing the goal 10 | #, sh-format 11 | msgid "$MISSION_DIR/goal/en.txt" 12 | msgstr "" 13 | 14 | msgid "Book_of_potions" 15 | msgstr "" 16 | 17 | msgid "You altered the book..." 18 | msgstr "" 19 | 20 | msgid "You are not in the cave with Servillus!" 21 | msgstr "" 22 | 23 | msgid "You have not used the 'tail' command!" 24 | msgstr "" 25 | 26 | msgid "Your previous command does not give the expected result..." 27 | msgstr "" 28 | 29 | msgid "page" 30 | msgstr "" 31 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/02_tail/init.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/init.sh -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/02_tail/static.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/static.sh -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/03_cat/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | . alt_history_start.sh 4 | 5 | cd "$(eval_gettext '$GSH_HOME/Mountain/Cave')" 6 | 7 | # commands from a sourced file aren't saved in the history, 8 | # we need to do that explicitly 9 | add_cmd cat "$(gettext "Book_of_potions")/$(gettext "page")_01" "$(gettext "Book_of_potions")/$(gettext "page")_02" 10 | add_cmd gsh check 11 | gsh check 12 | 13 | . alt_history_stop.sh 14 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/03_cat/clean.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/clean.sh -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/03_cat/goal/en.txt: -------------------------------------------------------------------------------- 1 | Mission goal 2 | ============ 3 | 4 | While cleaning the dishes, Servillus mentions an interesting potion 5 | that lets the drinker (temporarily) take the physical appearance of 6 | anyone. 7 | Read the recipe of the potion from the hermit's book. 8 | 9 | In order to validate the mission, you need to be in the cave with 10 | Servillus **and** your last command prior to ``gsh check`` must show 11 | the whole recipe (with its title). 12 | 13 | Note: you shouldn't alter the content of the book of potions. 14 | 15 | 16 | Useful commands 17 | =============== 18 | 19 | cat FILE1 FILE2 ... FILEn 20 | Display the contents of the files in order. 21 | Remark: ``cat`` is an abbreviation for "concatenate". 22 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/03_cat/goal/fr.txt: -------------------------------------------------------------------------------- 1 | Objectif 2 | ======== 3 | 4 | Pendant qu'il fait la vaisselle, Servillus mentionne une potion 5 | intéressante qui donne (temporairement) au buveur l'apparence 6 | physique de quelqu'un d'autre. 7 | Lisez cette recette dans le livre de l'ermite. 8 | 9 | Pour valider la mission, vous devez vous trouver dans la grotte avec 10 | Servillus **et** votre dernière commande avant ``gsh check`` doit 11 | afficher la recette complète (avec son titre). 12 | 13 | Attention, vous ne devez pas modifier le contenu du livre de potions. 14 | 15 | 16 | Commandes utiles 17 | ================ 18 | 19 | cat FICHIER1 FICHIER2 ... FICHIERn 20 | Affiche le contenu des fichiers, dans l'ordre donné. 21 | Note : ``cat`` est une abréviation de "concatenate". 22 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/03_cat/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivi missione 2 | ==================== 3 | 4 | Mentre pulisce i piatti, Servillus menziona un'interessante pozione 5 | che permette a chi la beve di prendere le sembianze di chiunque altro. 6 | Leggi la ricetta della pozione dal libro dell'eremita. 7 | 8 | Per rendere la missione valida, devi essere nella grotta con Servillus 9 | **e** il tuo ultimo comando prima di ``gsh check`` deve visualizzare 10 | tutta la ricetta (incluso il titolo). 11 | 12 | Comandi utili 13 | ============= 14 | 15 | cat FILE1 FILE2 ... FILEn 16 | Visualizza il contenuto dei file in ordine. 17 | Ricorda: ``cat`` è un'abbreviazione per "concatena". 18 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/03_cat/i18n/template.pot: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 3 | "Content-Transfer-Encoding: 8bit\n" 4 | 5 | #, sh-format 6 | msgid "$GSH_HOME/Mountain/Cave" 7 | msgstr "" 8 | 9 | # path for the text file containing the goal 10 | #, sh-format 11 | msgid "$MISSION_DIR/goal/en.txt" 12 | msgstr "" 13 | 14 | msgid "Book_of_potions" 15 | msgstr "" 16 | 17 | msgid "You altered the book..." 18 | msgstr "" 19 | 20 | msgid "You are not in the cave with Servillus!" 21 | msgstr "" 22 | 23 | msgid "You have not used the 'cat' command!" 24 | msgstr "" 25 | 26 | msgid "Your previous command does not give the expected result..." 27 | msgstr "" 28 | 29 | msgid "page" 30 | msgstr "" 31 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/03_cat/init.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/init.sh -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/03_cat/static.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/static.sh -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/04_pipe/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | . alt_history_start.sh 4 | 5 | cd "$(eval_gettext '$GSH_HOME/Mountain/Cave')" 6 | 7 | # commands from a sourced file aren't saved in the history, 8 | # we need to do that explicitly 9 | add_cmd "cat \"$(gettext "Book_of_potions")/$(gettext "page")_0\"[34] | tail -n 16" 10 | add_cmd gsh check 11 | gsh check 12 | 13 | . alt_history_stop.sh 14 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/04_pipe/clean.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/clean.sh -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/04_pipe/i18n/template.pot: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 3 | "Content-Transfer-Encoding: 8bit\n" 4 | 5 | #, sh-format 6 | msgid "$GSH_HOME/Mountain/Cave" 7 | msgstr "" 8 | 9 | # path for the text file containing the goal 10 | #, sh-format 11 | msgid "$MISSION_DIR/goal/en.txt" 12 | msgstr "" 13 | 14 | msgid "Book_of_potions" 15 | msgstr "" 16 | 17 | msgid "You altered the book..." 18 | msgstr "" 19 | 20 | msgid "You are not in the cave with Servillus!" 21 | msgstr "" 22 | 23 | msgid "You have not used the 'tail' command!" 24 | msgstr "" 25 | 26 | msgid "Your previous command does not give the expected result..." 27 | msgstr "" 28 | 29 | msgid "page" 30 | msgstr "" 31 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/04_pipe/init.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/init.sh -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/04_pipe/static.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/static.sh -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/05_pipe_head_tail/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | . alt_history_start.sh 4 | 5 | cd "$(eval_gettext '$GSH_HOME/Mountain/Cave')" 6 | 7 | # commands from a sourced file aren't saved in the history, 8 | # we need to do that explicitly 9 | add_cmd "head -n 6 \"$(gettext "Book_of_potions")/$(gettext "page")_13\" | tail -n 3" 10 | add_cmd gsh check 11 | gsh check 12 | 13 | . alt_history_stop.sh 14 | -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/05_pipe_head_tail/clean.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/clean.sh -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/05_pipe_head_tail/init.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/init.sh -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/05_pipe_head_tail/static.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/static.sh -------------------------------------------------------------------------------- /missions/pipe_intro_book_of_potions/default.idx: -------------------------------------------------------------------------------- 1 | !00_shared 2 | 01_head 3 | 02_tail 4 | 03_cat 5 | 04_pipe 6 | 05_pipe_head_tail 7 | -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/00_shared/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # need to be careful, as there are so many files in the Stall that 4 | # rm Stall/* may not work. 5 | # find ... -exec rm "{}" -; is too slow 6 | # so I use find ... -delete 7 | # this is not POSIX but looks supported on Linux, OpenBSD, FreeBSD and MacOS 8 | # (The POSIX alternative is to remove the Stall directory itself with rm -rf, 9 | # and recreate it. But this can cause problems if the user is in the stall and uses a subshell for 10 | # gsh check or gsh reset.) 11 | 12 | find "$(eval_gettext '$GSH_HOME/Stall')" -type f -delete 13 | rm -f "$GSH_TMP/nb_commands" "$GSH_TMP/last_command" 14 | 15 | PS1=$_PS1 16 | unset _PS1 17 | 18 | rm -f "$GSH_TMP/nbUnpaid" "$GSH_TMP/amountKing" 19 | -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/00_shared/data/lastnames.en: -------------------------------------------------------------------------------- 1 | Ageorges 2 | Alamartine 3 | Anglais 4 | Aubernard 5 | Boulanger 6 | Cabrera 7 | Chauvin 8 | Coulomb 9 | Coulon 10 | Courtois 11 | Duchesne 12 | Fromentin 13 | Langlois 14 | Larsonneur 15 | Legros 16 | Lenain 17 | Marchand 18 | Messonnier 19 | Métivier 20 | Pelletier 21 | Poudevigne 22 | Rabier 23 | Roux 24 | Sarrazin 25 | 26 | Georges' son 27 | from next town 28 | the Bold 29 | the son of Martin 30 | du Chêne 31 | -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/00_shared/data/lastnames.fr: -------------------------------------------------------------------------------- 1 | Ageorges 2 | Alamartine 3 | Anglais 4 | Aubernard 5 | Boulanger 6 | Cabrera 7 | Chauvin 8 | Coulomb 9 | Coulon 10 | Courtois 11 | Duchesne 12 | Fromentin 13 | Langlois 14 | Larsonneur 15 | Legros 16 | Lenain 17 | Marchand 18 | Messonnier 19 | Métivier 20 | Pelletier 21 | Poudevigne 22 | Rabier 23 | Roux 24 | Sarrazin 25 | 26 | du village voisin 27 | le Chauve 28 | le fils de Martin 29 | le fils au George 30 | du Chêne 31 | -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/00_shared/data/lastnames.it: -------------------------------------------------------------------------------- 1 | Rossi 2 | Ferrari 3 | Russo 4 | Bianchi 5 | Romano 6 | Gallo 7 | Costa 8 | Fontana 9 | Conti 10 | Esposito 11 | Ricci 12 | Bruno 13 | De Luca 14 | Moretti 15 | Marino 16 | Greco 17 | Barbieri 18 | Lombardi 19 | Giordano 20 | Cassano 21 | Colombo 22 | Mancini 23 | Longo 24 | Leone 25 | Martinelli 26 | Rossi 27 | Ferrari 28 | Russo 29 | Bianchi 30 | Romano 31 | Gallo 32 | Costa 33 | Fontana 34 | Conti 35 | Esposito 36 | Ricci 37 | Bruno 38 | De Luca 39 | Moretti 40 | Marino 41 | Greco 42 | Barbieri 43 | Lombardi 44 | Giordano 45 | Cassano 46 | Colombo 47 | Mancini 48 | Longo 49 | Leone 50 | Martinelli 51 | 52 | 53 | 54 | Il figlio di Giorgio 55 | della cittá vicina 56 | il Grosso 57 | Il figlio di Martino 58 | di Quercia 59 | -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/00_shared/data/objects.en: -------------------------------------------------------------------------------- 1 | a bag flour 2 | a belt 3 | a blanket 4 | a bottle of cider 5 | a chackal 6 | a chicken 7 | a cow 8 | a dented helmet 9 | a goat 10 | a horse 11 | a knife 12 | a leather bag 13 | a leather ball 14 | a pick 15 | a piece of soap 16 | a pin 17 | a ruby 18 | a shiny rock 19 | a spade 20 | a stool 21 | a wooden spoon 22 | an apple 23 | an opal 24 | a walking stick 25 | -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/00_shared/data/objects.fr: -------------------------------------------------------------------------------- 1 | un sac de farine 2 | une ceinture 3 | une couverture 4 | une bouteille de cidre 5 | un chacal 6 | une poule 7 | une vache 8 | un heaume cabossé 9 | une chèvre 10 | un cheval 11 | un couteau 12 | une besace en cuir 13 | une balle en cuir 14 | un pic 15 | un morceau de savon 16 | une épingle 17 | un rubis 18 | un caillou brillant 19 | une pelle 20 | un tabouret 21 | une cuillère en bois 22 | une pomme 23 | une opale 24 | un baton de marche 25 | -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/00_shared/data/objects.it: -------------------------------------------------------------------------------- 1 | un sacchetto di farina 2 | una cintura 3 | una coperta 4 | una bottiglia di sidro 5 | un po di ciarpame 6 | un pollo 7 | una mucca 8 | un casco ammaccato 9 | una capra 10 | un cavallo 11 | un coltello 12 | una borsa in pelle 13 | una palla di cuoio 14 | una scelta 15 | un pezzo di sapone 16 | uno spillo 17 | un rubino 18 | una roccia lucente 19 | una vanga 20 | uno sgabello 21 | un cucchiaio di legno 22 | una mela 23 | un opale 24 | un bastone da passeggio 25 | -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/00_shared/i18n/en.po: -------------------------------------------------------------------------------- 1 | # AUTOMATICALLY GENERATED -- DO NOT EDIT 2 | msgid "" 3 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 4 | "Content-Transfer-Encoding: 8bit\n" 5 | 6 | #, sh-format 7 | msgid "$GSH_HOME/Stall" 8 | msgstr "$GSH_HOME/Stall" 9 | 10 | msgid "%s bought %s for %d coppers%s" 11 | msgstr "%s bought %s for %d coppers%s" 12 | 13 | msgid "PAID" 14 | msgstr "PAID" 15 | 16 | msgid "boring_object" 17 | msgstr "boring_object" 18 | 19 | msgid "firstnames.en" 20 | msgstr "firstnames.en" 21 | 22 | msgid "lastnames.en" 23 | msgstr "lastnames.en" 24 | 25 | msgid "objects.en" 26 | msgstr "objects.en" 27 | 28 | msgid "s_c_r_o_l_l" 29 | msgstr "s_c_r_o_l_l" 30 | 31 | msgid "the King" 32 | msgstr "the King" 33 | -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/00_shared/i18n/fr.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 3 | "Content-Transfer-Encoding: 8bit\n" 4 | 5 | #, sh-format 6 | msgid "$GSH_HOME/Stall" 7 | msgstr "$GSH_HOME/Echoppe" 8 | 9 | msgid "%s bought %s for %d coppers%s" 10 | msgstr "%s a acheté %s pour %d piécettes%s" 11 | 12 | msgid "PAID" 13 | msgstr "PAYÉ" 14 | 15 | msgid "boring_object" 16 | msgstr "objet_sans_interet" 17 | 18 | msgid "firstnames.en" 19 | msgstr "firstnames.en" 20 | 21 | msgid "lastnames.en" 22 | msgstr "lastnames.fr" 23 | 24 | msgid "objects.en" 25 | msgstr "objects.fr" 26 | 27 | msgid "s_c_r_o_l_l" 28 | msgstr "p_a_r_c_h_e_m_i_n" 29 | 30 | msgid "the King" 31 | msgstr "le Roi" 32 | -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/00_shared/i18n/template.pot: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 3 | "Content-Transfer-Encoding: 8bit\n" 4 | 5 | #, sh-format 6 | msgid "$GSH_HOME/Stall" 7 | msgstr "" 8 | 9 | msgid "%s bought %s for %d coppers%s" 10 | msgstr "" 11 | 12 | msgid "PAID" 13 | msgstr "" 14 | 15 | msgid "boring_object" 16 | msgstr "" 17 | 18 | msgid "firstnames.en" 19 | msgstr "" 20 | 21 | msgid "lastnames.en" 22 | msgstr "" 23 | 24 | msgid "objects.en" 25 | msgstr "" 26 | 27 | msgid "s_c_r_o_l_l" 28 | msgstr "" 29 | 30 | msgid "the King" 31 | msgstr "" 32 | -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/00_shared/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext '$GSH_HOME/Stall')" 4 | -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/01_pipe_1/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # 3 | # FIXME? I use bash' process substitution to avoid creating a subshell 4 | 5 | cd "$(eval_gettext '$GSH_HOME/Stall')" 6 | 7 | # beware, there are so many files that we may get "bash: /usr/bin/grep: Argument list too long" 8 | # so we use recursive grep on the diectory instead of globbing 9 | gsh check < <(grep -r "$(gettext "the King")" "$(eval_gettext '$GSH_HOME/Stall')" | 10 | grep -v "$(gettext "PAID")" | 11 | grep -o "[0-9]* [^0-9]*$" | 12 | awk '{s+=$1} END{print s}') 13 | -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/01_pipe_1/check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_check() ( 4 | amount=$(cat "$GSH_TMP/amountKing") 5 | printf "%s " "$(gettext "How much does the king owe?")" 6 | read -r response 7 | nb_cmd=$(cat "$GSH_TMP/nb_commands") 8 | 9 | # TODO, check the "boring objects" are still here, to avoid the possibility 10 | # rm *boring* 11 | # ... 12 | 13 | if [ "$response" != "$amount" ] 14 | then 15 | echo "$(gettext "That's not the right answer!")" 16 | return 1 17 | elif [ "$nb_cmd" -gt 3 ] 18 | then 19 | echo "$(eval_gettext "That's the right answer, but you used \$nb_cmd commands!")" 20 | return 1 21 | fi 22 | return 0 23 | ) 24 | 25 | _mission_check 26 | -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/01_pipe_1/clean.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/clean.sh -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/01_pipe_1/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_init() { 4 | if ! command -v generate_merchant_stall.sh >/dev/null 5 | then 6 | # FIXME: change message 7 | echo "$(eval_gettext "The script 'generate_merchant_stall.sh' is necessary for mission \$MISSION_NAME. 8 | Make sure the corresponding mission is included.")" >&2 9 | return 1 10 | fi 11 | 12 | generate_merchant_stall.sh "$(eval_gettext '$GSH_HOME/Stall')" 13 | 14 | mission_source "$MISSION_DIR/../00_shared/count_commands.sh" 15 | 16 | return 0 17 | } 18 | 19 | _mission_init 20 | -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/01_pipe_1/static.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/static.sh -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/02_pipe_2/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # FIXME? I use bash' process substitution to avoid creating a subshell 4 | 5 | cd "$(eval_gettext '$GSH_HOME/Stall')" 6 | 7 | # beware, there are so many files that we may get "bash: /usr/bin/grep: Argument list too long" 8 | # so we use recursive grep on the directory instead of globbing 9 | gsh check < <(grep -rv "$(gettext "PAID")" "$(eval_gettext '$GSH_HOME/Stall')" | wc -l) 10 | -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/02_pipe_2/check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_check() ( 4 | nb_unpaid=$(cat "$GSH_TMP/nbUnpaid") 5 | printf "%s " "$(gettext "How many unpaid items are there?")" 6 | read -r response 7 | nb_cmd=$(cat "$GSH_TMP/nb_commands") 8 | 9 | # TODO, check the "boring objects" are still here, to avoid the possibility 10 | # rm *boring* 11 | # ... 12 | 13 | if [ "$response" != "$nb_unpaid" ] 14 | then 15 | echo "$(gettext "That's not the right answer!")" 16 | return 1 17 | elif [ "$nb_cmd" -gt 1 ] 18 | then 19 | echo "$(eval_gettext "That's the right answer, but you used \$nb_cmd commands!")" 20 | return 1 21 | fi 22 | return 0 23 | ) 24 | 25 | _mission_check 26 | -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/02_pipe_2/clean.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/clean.sh -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/02_pipe_2/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_init() { 4 | if ! command -v generate_merchant_stall.sh >/dev/null 5 | then 6 | # FIXME: change message 7 | echo "$(eval_gettext "The script 'generate_merchant_stall.sh' is necessary for mission \$MISSION_NAME. 8 | Make sure the corresponding mission is included.")" >&2 9 | return 1 10 | fi 11 | 12 | generate_merchant_stall.sh "$(eval_gettext '$GSH_HOME/Stall')" 13 | 14 | mission_source "$MISSION_DIR/../00_shared/count_commands.sh" 15 | 16 | return 0 17 | } 18 | 19 | _mission_init 20 | 21 | -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/02_pipe_2/static.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/static.sh -------------------------------------------------------------------------------- /missions/pipes_merchant_stall/default.idx: -------------------------------------------------------------------------------- 1 | !00_shared 2 | 01_pipe_1 3 | 02_pipe_2 4 | -------------------------------------------------------------------------------- /missions/processes/00_shared/my_ps-linux: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | if [ -z "$*" ] 4 | then 5 | ps -o pid,ppid,comm 6 | else 7 | ps -o pid,ppid,comm -p $* 8 | fi 9 | 10 | -------------------------------------------------------------------------------- /missions/processes/00_shared/my_ps-macos: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | if [ -z "$*" ] 4 | then 5 | ps -ceo pid,ppid,comm 6 | else 7 | ps -ceo pid,ppid,comm -p $* 8 | fi 9 | 10 | -------------------------------------------------------------------------------- /missions/processes/00_shared/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # for some unkwnown reason, `ps -o pid,ppid,comm` doesn't find any process 4 | # on the "macos-latest" image on github. 5 | # I'm not sure if that's a problem with github images, or with macos. 6 | # So, we use a different command when we detect this problem! 7 | 8 | if ps -o pid,ppid,comm >/dev/null 2>/dev/null 9 | then 10 | # standard ps -o pid,ppid,comm 11 | copy_bin "$MISSION_DIR/my_ps-linux" "$GSH_ROOT/.sbin/my_ps" 12 | else 13 | # with additional options ps -ceo pid,ppid,comm 14 | copy_bin "$MISSION_DIR/my_ps-macos" "$GSH_ROOT/.sbin/my_ps" 15 | fi 16 | -------------------------------------------------------------------------------- /missions/processes/00_shared/test-proc-name.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | sleep 100 3 | -------------------------------------------------------------------------------- /missions/processes/01_ps_kill/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | my_ps | awk -v spell="$(gettext "spell")" '$0 ~ spell {print $1}' | xargs kill -9 2> /dev/null 4 | sleep 1 5 | gsh check 6 | -------------------------------------------------------------------------------- /missions/processes/01_ps_kill/check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_check() ( 4 | if my_ps $(cat "$GSH_TMP/spell.pid") | grep -q "$(gettext "spell")" 5 | then 6 | echo "$(gettext "The spell is still running!")" 7 | return 1 8 | fi 9 | return 0 10 | ) 11 | 12 | _mission_check 13 | -------------------------------------------------------------------------------- /missions/processes/01_ps_kill/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | kill -9 "$(cat "$GSH_TMP/spell.pid")" 2>/dev/null 4 | my_ps | awk '/sleep|tail/ {print $1}' | xargs kill -9 2>/dev/null 5 | 6 | [ -n "$GSH_NON_INTERACTIVE" ] || set -o monitor # monitor background processes (default) 7 | rm -f "$GSH_TMP/spell.pid" "$GSH_TMP/$(gettext "spell")" 8 | -------------------------------------------------------------------------------- /missions/processes/01_ps_kill/deps.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/init.sh -------------------------------------------------------------------------------- /missions/processes/01_ps_kill/goal.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | export PS 4 | if ps -c | head -n1 | grep CLS 2>/dev/null >/dev/null 5 | then 6 | PS="ps" 7 | else 8 | PS="ps -c" 9 | fi 10 | 11 | sed "s/\\\$PS/$PS/g" "$(eval_gettext '$MISSION_DIR/goal/en.txt')" 12 | unset PS 13 | -------------------------------------------------------------------------------- /missions/processes/01_ps_kill/goal/en.txt: -------------------------------------------------------------------------------- 1 | Mission goal 2 | ============ 3 | 4 | A mischievous imp cast a spell that puts smudges of coal everywhere 5 | in the castle. 6 | Find this spell and remove it. 7 | 8 | Remark 9 | ------ 10 | 11 | The spell is a process. 12 | 13 | 14 | Useful commands 15 | =============== 16 | 17 | $PS 18 | List the processes that are currently executed by the shell. 19 | 20 | kill N 21 | Send the termination signal to process number N. 22 | Remark: N is called PID, or "process identifier". 23 | 24 | clear 25 | Clear the screen. 26 | The keybinding "Control-L" does the same and is often quicker to 27 | use in the terminal. 28 | -------------------------------------------------------------------------------- /missions/processes/01_ps_kill/goal/fr.txt: -------------------------------------------------------------------------------- 1 | Objectif 2 | ======== 3 | 4 | Un lutin espiègle a lancé un sortilège qui fait apparaitre des 5 | traces de charbon un peu partout dans le château. 6 | Trouvez ce sortilège et supprimez-le. 7 | 8 | 9 | Remarque 10 | -------- 11 | 12 | Le sortilège est un processus. 13 | 14 | 15 | Commandes utiles 16 | ================ 17 | 18 | $PS 19 | Affiche la liste des processus lancés par le shell. 20 | 21 | kill N 22 | Envoie le signal d'arrêt au processus numéro N. 23 | Note : N est appelé le PID ("process identifier") du processus. 24 | 25 | clear 26 | Efface l'écran du terminal. 27 | La combinaison de touches "Control-L" fait la même chose et est 28 | souvent plus rapide à utiliser dans un terminal. 29 | -------------------------------------------------------------------------------- /missions/processes/01_ps_kill/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivi Missione 2 | ======================== 3 | 4 | Un demone malizioso ha lanciato un sortilegio che mette macchie di 5 | carbone ovunque nel castello. 6 | Trova il sortilegio e rimuovilo 7 | 8 | Nota 9 | ---- 10 | 11 | Il sortilegio è un processo 12 | 13 | 14 | Comandi utili 15 | ============= 16 | 17 | $PS 18 | Elenca i processi che sono attualmente eseguiti dalla shell. 19 | 20 | kill N 21 | Manda il segnale di cessazione al processo numero N. 22 | Nota: N è chiamato PID, o "identificatore di processo". 23 | 24 | clear 25 | Pulisce la schermata del terminale. 26 | La combinazione "Control-L" fa la stessa cosa ed è spesso 27 | più veloce da usare nel terminale. 28 | -------------------------------------------------------------------------------- /missions/processes/01_ps_kill/spell.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #define NB_LINES 3 7 | #define MAX_SIZE 6 8 | #define MAX_SPACES 30 9 | #define SLEEP_TIME 5 10 | 11 | char coal[NB_LINES][MAX_SIZE + 1] = { 12 | " *#@*", 13 | "&_**/~", 14 | " !$-#", 15 | }; 16 | 17 | char spaces[MAX_SPACES + 1] = " "; 18 | 19 | int main() 20 | { 21 | srand(time(NULL)); 22 | while (1) { 23 | sleep(SLEEP_TIME); 24 | printf("\n"); 25 | char* s = spaces + (rand() % MAX_SPACES); 26 | for (int i = 0; i < NB_LINES; i++) { 27 | printf("%s%s\n", s, coal[i]); 28 | } 29 | printf("\n"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /missions/processes/01_ps_kill/spell.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | trap clean TERM 4 | 5 | clean() { 6 | jobs -p | xargs kill 7 | exit 0 8 | } 9 | 10 | DELAY=5 11 | 12 | while true 13 | do 14 | sleep $DELAY & wait $! 15 | INDENT=$(echo " " | cut -c1-$((2+$(RANDOM)%15))) 16 | cat <<'EOS' | sed "s/^/$INDENT/g" 17 | 18 | *#@* 19 | &_**/~ 20 | !$-# 21 | 22 | EOS 23 | done 24 | -------------------------------------------------------------------------------- /missions/processes/01_ps_kill/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | my_ps | awk -v spell="$(gettext "spell")" '$0 ~ spell {print $1}' | xargs kill -9 2>/dev/null 4 | sleep 1 5 | gsh assert check true 6 | 7 | gsh assert check false 8 | -------------------------------------------------------------------------------- /missions/processes/02_ps_kill_signal/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | my_ps | awk -v spell="$(gettext "spell")" '$0 ~ spell {print $1}' | xargs kill 2>/dev/null 4 | sleep 1 5 | my_ps | awk -v spell="$(gettext "spell")" '$0 ~ spell {print $1}' | xargs kill -9 2>/dev/null 6 | sleep 1 7 | gsh check 8 | -------------------------------------------------------------------------------- /missions/processes/02_ps_kill_signal/check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_check() ( 4 | nb_spells=$(my_ps | grep -c "$(gettext "spell")" | tr -d ' ') 5 | 6 | if [ "$nb_spells" -gt 0 ] 7 | then 8 | echo "$(eval_gettext "Some spells (\$nb_spells) are still running!")" 9 | return 1 10 | fi 11 | 12 | nb=$(wc -l "$GSH_TMP/spell.pids" | awk '{print $1}') 13 | if [ "$nb" -eq 1 ] 14 | then 15 | echo "$(gettext "You haven't tried using the standard TERM signal on the spell.")" 16 | return 1 17 | fi 18 | 19 | return 0 20 | ) 21 | 22 | _mission_check 23 | -------------------------------------------------------------------------------- /missions/processes/02_ps_kill_signal/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | kill -9 $(cat "$GSH_TMP/spell-term.pids" 2>/dev/null) 2>/dev/null 4 | kill -9 $(cat "$GSH_TMP/spell.pids" 2>/dev/null) 2>/dev/null 5 | my_ps | awk '/sleep|tail/ {print $1}' | xargs kill -9 2>/dev/null 6 | rm -f "$GSH_TMP/spell-term.pids" "$GSH_TMP/spell.pids" "$GSH_TMP/$(gettext "spell")" 7 | rm --system -f /dev/shm/"sem.writing_sem_${USER}" 8 | rm --system -f /dev/shm/"sem.printing_sem_${USER}" 9 | [ -n "$GSH_NON_INTERACTIVE" ] || set -o monitor # monitor background processes (default) 10 | -------------------------------------------------------------------------------- /missions/processes/02_ps_kill_signal/deps.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/init.sh -------------------------------------------------------------------------------- /missions/processes/02_ps_kill_signal/goal.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | export PS 4 | if ps -c | head -n1 | grep CLS 2>/dev/null >/dev/null 5 | then 6 | PS="ps" 7 | else 8 | PS="ps -c" 9 | fi 10 | 11 | sed "s/\\\$PS/$PS/g" "$(eval_gettext '$MISSION_DIR/goal/en.txt')" 12 | unset PS 13 | -------------------------------------------------------------------------------- /missions/processes/02_ps_kill_signal/spell.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | . gsh_gettext.sh 4 | 5 | trap spawn TERM 6 | 7 | spawn() { 8 | echo "$(gettext "You'll need to do better than that to kill my spell!")" 9 | "$0" & 10 | echo $! >> "$GSH_TMP/spell.pids" 11 | } 12 | 13 | DELAY=5 14 | 15 | while true 16 | do 17 | sleep $DELAY & wait $! 18 | r=$(RANDOM) 19 | INDENT=$(echo " " | cut -c1-$((2+r%15))) 20 | cat <<'EOS' | sed "s/^/$INDENT/g" 21 | 22 | *#@* 23 | $@%#\4 24 | &"_'%<@ 25 | +8^@j 26 | #!v@ 27 | 28 | EOS 29 | done 30 | -------------------------------------------------------------------------------- /missions/processes/03_pstree_kill/ascii-art/coal-0.txt: -------------------------------------------------------------------------------- 1 | @/+- 2 | /#@@$/$ 3 | %/^#/%/_% 4 | ##^%^%%$\+ 5 | @^$^%%%$-% 6 | #^_@/# 7 | -------------------------------------------------------------------------------- /missions/processes/03_pstree_kill/ascii-art/coal-1.txt: -------------------------------------------------------------------------------- 1 | #%^_ 2 | ^%-$#_- 3 | #&$^\$% 4 | \^%/\\@+ 5 | /@-$ 6 | %^-&// 7 | _^^* 8 | * 9 | -------------------------------------------------------------------------------- /missions/processes/03_pstree_kill/ascii-art/coal-2.txt: -------------------------------------------------------------------------------- 1 | &# 2 | ^_#$$ 3 | /_/%%#%% 4 | -/$$/^$*$ 5 | &%#$_#_$^ 6 | %@+%/* 7 | -------------------------------------------------------------------------------- /missions/processes/03_pstree_kill/ascii-art/coal-3.txt: -------------------------------------------------------------------------------- 1 | %#&/%& 2 | $/##/#-%^ 3 | $#$%@_#@-@# 4 | @^\&&%+#_@ 5 | #*@%%/^_ 6 | -------------------------------------------------------------------------------- /missions/processes/03_pstree_kill/ascii-art/snowflake-0.txt: -------------------------------------------------------------------------------- 1 | . 2 | : 3 | '.___/*\___.' 4 | \* \ / */ 5 | >--X--< 6 | /*_/ \_*\ 7 | .' \*/ '. 8 | : jgs 9 | ' 10 | -------------------------------------------------------------------------------- /missions/processes/03_pstree_kill/ascii-art/snowflake-1.txt: -------------------------------------------------------------------------------- 1 | _ _ 2 | /_/ \_\ 3 | \\// 4 | /\_\\><\\ \/ 6 | _//\\_ jgs 7 | \_\ /_/ 8 | -------------------------------------------------------------------------------- /missions/processes/03_pstree_kill/ascii-art/snowflake-2.txt: -------------------------------------------------------------------------------- 1 | . . 2 | _\/ \/_ 3 | _\/\/_ 4 | _\_\_\/\/_/_/_ 5 | / /_/\/\_\ \ 6 | _/\/\_ 7 | /\ /\ jgs 8 | ' ' 9 | -------------------------------------------------------------------------------- /missions/processes/03_pstree_kill/ascii-art/snowflake-3.txt: -------------------------------------------------------------------------------- 1 | * . * 2 | . _\/ \/_ . 3 | \ \ / / 4 | -==>: X :<==- 5 | / _/ \_ \ 6 | ' /\ /\ ' jgs 7 | * ' * 8 | -------------------------------------------------------------------------------- /missions/processes/03_pstree_kill/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | kill_imp_spell() ( 4 | imp_proc="$(gettext "mischievous_imp" | cut -c1-15)" 5 | p=$(my_ps | grep "$imp_proc" | awk '{print $1}') 6 | my_ps | 7 | awk -v PID="$p" -v spell="$(gettext "spell")" '($2 == PID) && ($3 ~ spell) {print $1}' | 8 | xargs kill -9 2>/dev/null 9 | ) 10 | cellar=$(eval_gettext '$GSH_HOME/Castle/Cellar') 11 | 12 | 13 | kill_imp_spell 14 | sleep 1 15 | rm -f "$cellar"/*_"$(gettext "coal")" 16 | gsh check 17 | 18 | unset -f kill_imp_spell 19 | unset cellar 20 | -------------------------------------------------------------------------------- /missions/processes/03_pstree_kill/deps.sh: -------------------------------------------------------------------------------- 1 | ../00_shared/init.sh -------------------------------------------------------------------------------- /missions/processes/03_pstree_kill/fairy/spell.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | . gsh_gettext.sh 4 | 5 | DELAY=3 6 | OFFSET=$1 7 | 8 | sleep "${OFFSET:-1}" 9 | while true 10 | do 11 | filename="$(eval_gettext '$GSH_HOME/Castle/Cellar')/$(RANDOM)_$(gettext "snowflake")" 12 | sign_file "$MISSION_DIR/ascii-art/snowflake-$(($(RANDOM)%4)).txt" "$filename" 13 | echo "${filename#$(eval_gettext '$GSH_HOME/Castle/Cellar')/}" >> "$GSH_TMP/snowflakes.list" 14 | sleep $DELAY & wait $! 15 | done 16 | 17 | -------------------------------------------------------------------------------- /missions/processes/03_pstree_kill/imp/spell.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | . gsh_gettext.sh 4 | 5 | DELAY=3 6 | OFFSET=$1 7 | 8 | sleep "${OFFSET:-1}" 9 | while true 10 | do 11 | filename="$(eval_gettext '$GSH_HOME/Castle/Cellar')/$(RANDOM)_$(gettext "coal")" 12 | sign_file "$MISSION_DIR/ascii-art/coal-$(($(RANDOM)%4)).txt" "$filename" 13 | echo "${filename#$(eval_gettext '$GSH_HOME/Castle/Cellar')/}" >> "$GSH_TMP/coals.list" 14 | sleep $DELAY & wait $! 15 | done 16 | 17 | -------------------------------------------------------------------------------- /missions/processes/03_pstree_kill/mischievous_imp.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . gsh_gettext.sh 4 | 5 | "$GSH_TMP/imp/$(gettext "spell")" 0 & 6 | printf "$!," > "$GSH_TMP/imp_spell.pids" 7 | 8 | "$GSH_TMP/imp/$(gettext "spell")" 1 & 9 | printf "$!," >> "$GSH_TMP/imp_spell.pids" 10 | 11 | "$GSH_TMP/imp/$(gettext "spell")" 2 & 12 | printf "$!" >> "$GSH_TMP/imp_spell.pids" 13 | 14 | 15 | trap "" TERM INT 16 | tail -f /dev/null 17 | -------------------------------------------------------------------------------- /missions/processes/03_pstree_kill/nice_fairy.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . gsh_gettext.sh 4 | 5 | "$GSH_TMP/fairy/$(gettext "spell")" 0 & 6 | printf "$!," > "$GSH_TMP/fairy_spell.pids" 7 | 8 | "$GSH_TMP/fairy/$(gettext "spell")" 1 & 9 | printf "$!," >> "$GSH_TMP/fairy_spell.pids" 10 | 11 | "$GSH_TMP/fairy/$(gettext "spell")" 2 & 12 | printf "$!" >> "$GSH_TMP/fairy_spell.pids" 13 | 14 | 15 | trap "" TERM INT 16 | tail -f /dev/null 17 | -------------------------------------------------------------------------------- /missions/processes/03_pstree_kill/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext '$GSH_HOME/Castle/Cellar')" 4 | 5 | -------------------------------------------------------------------------------- /missions/processes/default.idx: -------------------------------------------------------------------------------- 1 | !00_shared 2 | 01_ps_kill 3 | 02_ps_kill_signal 4 | 03_pstree_kill 5 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/01_stdin_additions/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | gsh check < "$GSH_TMP/additions.txt" 4 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/01_stdin_additions/check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_check() ( 4 | exec 3< "$GSH_TMP/arith.txt" 5 | while IFS='' read -r line <&3 6 | do 7 | question="$(echo "$line" | cut -d"|" -f1)" 8 | result="$(echo "$line" | cut -d"|" -f2)" 9 | 10 | printf "%s" "$question" 11 | read -r response 12 | case "$response" in 13 | "" | *[!0-9]*) 14 | echo "$(gettext "That's not even a number!")" 15 | return 1 16 | ;; 17 | *) 18 | if [ "$result" -ne "$response" ] 19 | then 20 | echo "$(eval_gettext 'Too bad! The answer was $result...')" 21 | return 1 22 | fi 23 | ;; 24 | esac 25 | done 26 | return 0 27 | ) 28 | 29 | _mission_check 30 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/01_stdin_additions/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | rm -f "$GSH_TMP/arith.txt" "$GSH_TMP/additions.txt" 4 | 5 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/01_stdin_additions/goal/en.txt: -------------------------------------------------------------------------------- 1 | Mission goal 2 | ============ 3 | 4 | To get better in the magical art, one needs to know mental math. 5 | 6 | Get ready, because Merlin is about to test your precision with sums. 7 | 8 | Run the command ``gsh check`` to start. 9 | 10 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/01_stdin_additions/goal/fr.txt: -------------------------------------------------------------------------------- 1 | Objectif 2 | ======== 3 | 4 | Pour progresser en magie, il faut maitriser le calcul mental ! 5 | 6 | Préparez vous, car Merlin va tester votre précision sur des 7 | additions. 8 | 9 | Lancez la commande ``gsh check`` pour commencer. 10 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/01_stdin_additions/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivi Missione 2 | ============ 3 | 4 | Per migliorare nelle arti magiche, bisogna saper far calcoli a mente. 5 | 6 | Preparti perchè Merlino sta per mettere alla prova la tua precisione con le somme. 7 | 8 | Esegui il comando ``gsh check`` per iniziare. 9 | 10 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/01_stdin_additions/i18n/fr.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 3 | "Content-Transfer-Encoding: 8bit\n" 4 | 5 | # path for the text file containing the goal 6 | msgid "$MISSION_DIR/goal/en.txt" 7 | msgstr "$MISSION_DIR/goal/fr.txt" 8 | 9 | # path for the text file containing the skip message 10 | msgid "$MISSION_DIR/skip/en.txt" 11 | msgstr "$MISSION_DIR/skip/fr.txt" 12 | 13 | # path for the text file containing the treasure message 14 | msgid "$MISSION_DIR/treasure-msg/en.txt" 15 | msgstr "$MISSION_DIR/treasure-msg/fr.txt" 16 | 17 | msgid "That's not even a number!" 18 | msgstr "Ce n'est même pas un nombre !" 19 | 20 | #, sh-format 21 | msgid "Too bad! The answer was $result..." 22 | msgstr "Dommage ! La réponse était $result..." 23 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/01_stdin_additions/i18n/it.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 3 | "Content-Transfer-Encoding: 8bit\n" 4 | 5 | # path for the text file containing the goal 6 | msgid "$MISSION_DIR/goal/en.txt" 7 | msgstr "$MISSION_DIR/goal/it.txt" 8 | 9 | # path for the text file containing the skip message 10 | msgid "$MISSION_DIR/skip/en.txt" 11 | msgstr "$MISSION_DIR/skip/it.txt" 12 | 13 | # path for the text file containing the treasure message 14 | msgid "$MISSION_DIR/treasure-msg/en.txt" 15 | msgstr "$MISSION_DIR/treasure-msg/it.txt" 16 | 17 | msgid "That's not even a number!" 18 | msgstr "Non è nemmeno un numero!" 19 | 20 | #, sh-format 21 | msgid "Too bad! The answer was $result..." 22 | msgstr "Peccato! Il risultato era $result..." 23 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/01_stdin_additions/i18n/template.pot: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 3 | "Content-Transfer-Encoding: 8bit\n" 4 | 5 | # path for the text file containing the goal 6 | msgid "$MISSION_DIR/goal/en.txt" 7 | msgstr "" 8 | 9 | # path for the text file containing the skip message 10 | msgid "$MISSION_DIR/skip/en.txt" 11 | msgstr "" 12 | 13 | # path for the text file containing the treasure message 14 | msgid "$MISSION_DIR/treasure-msg/en.txt" 15 | msgstr "" 16 | 17 | msgid "That's not even a number!" 18 | msgstr "" 19 | 20 | #, sh-format 21 | msgid "Too bad! The answer was $result..." 22 | msgstr "" 23 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/01_stdin_additions/init.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_init() ( 4 | results=$GSH_TMP/additions.txt 5 | rm -f "$results" 6 | questions=$GSH_TMP/arith.txt 7 | rm -f "$questions" 8 | 9 | for _ in $(seq 5) 10 | do 11 | a=$((1+$(RANDOM)%100)) 12 | b=$((1+$(RANDOM)%100)) 13 | r=$((a + b)) 14 | echo $r >> "$results" 15 | echo "$a + $b = ?? |$r" >> "$questions" 16 | done 17 | ) 18 | 19 | _mission_init 20 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/02_stdin_redirection_multiplications/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | gsh check < "$(eval_gettext '$GSH_HOME/Castle/Main_building/Library')/$(gettext "Mathematics_101")" 4 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/02_stdin_redirection_multiplications/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | rm -f "$GSH_TMP/arith.txt" 4 | 5 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/02_stdin_redirection_multiplications/goal/en.txt: -------------------------------------------------------------------------------- 1 | Mission goal 2 | ============ 3 | 4 | To get better in the magical art, one needs to know mental math. 5 | 6 | Get ready, because Merlin is about to test your speed with products. 7 | 8 | Run the command ``gsh check`` to start. 9 | 10 | Remark 11 | ------ 12 | 13 | There now is a time constraint. 14 | 15 | Hint 16 | ---- 17 | 18 | The library is rumored to contain some mathematics books and hidden 19 | volumes. 20 | 21 | 22 | Useful commands 23 | =============== 24 | 25 | COMMAND < FILE 26 | Replace the command's standard input by a file. 27 | Instead of reading lines from the keyboard device, the command 28 | will read lines from the file. 29 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/02_stdin_redirection_multiplications/goal/fr.txt: -------------------------------------------------------------------------------- 1 | Objectif 2 | ======== 3 | 4 | Pour progresser en magie, il faut maitriser le calcul mental. 5 | 6 | Préparez vous, car Merlin va tester votre rapidité sur des 7 | multiplications. 8 | 9 | Lancez la commande ``gsh check`` pour commencer. 10 | 11 | Attention, il y a maintenant une limite de temps. 12 | 13 | Indices 14 | ------- 15 | 16 | Il parait que la bibliothèque du château contient des ouvrages de 17 | mathématiques et des carnets cachés. 18 | 19 | 20 | Commandes utiles 21 | ================ 22 | 23 | COMMANDE < FICHIER 24 | Remplace l'entrée standard de la commande par un fichier. 25 | Au lieu de lire les lignes sur le périphérique clavier, la 26 | commande lira les lignes du fichier. 27 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/02_stdin_redirection_multiplications/goal/it.txt: -------------------------------------------------------------------------------- 1 | Obiettivi Missione 2 | ============ 3 | 4 | Per migliorare nelle arti magiche, bisogna saper far calcoli a mente. 5 | 6 | Preparati perchè Merlino sta per mettere alla prova la tua precisione con le moltiplicazioni. 7 | 8 | Esegui il comando ``gsh check`` per iniziare. 9 | 10 | Attenzione 11 | ------ 12 | 13 | Ora c'è un limite di tempo. 14 | 15 | Suggerimento 16 | ---- 17 | 18 | Si dice che la libreria contenga alcuni libri di matematica e volumi nascosti. 19 | 20 | 21 | Comandi utili 22 | =============== 23 | 24 | COMANDO < FILE 25 | Rimpiazza l'input di un comando con un file. 26 | Invece di leggere le righe dalla tastiera, il comando 27 | leggerà le righe del file. 28 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/02_stdin_redirection_multiplications/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext '$GSH_HOME/Castle/Main_building/Library')" 4 | touch "$(eval_gettext '$GSH_HOME/Castle/Main_building/Library')/$(gettext "Mathematics_101")" 5 | touch "$(eval_gettext '$GSH_HOME/Castle/Main_building/Library')/$(gettext "Greek_Latin_and_other_modern_languages")" 6 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/03_stdout_redirection_inventory/ascii-art/candle.txt: -------------------------------------------------------------------------------- 1 | ) 2 | (_) 3 | |`| 4 | | | _() 5 | \_|_|_/ jgs 6 | 7 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/03_stdout_redirection_inventory/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | cd "$(eval_gettext '$GSH_HOME/Castle/Main_building/Library/Merlin_s_office')" 4 | ls "$(gettext "grimoire")"_* > "$(gettext "Drawer")/$(gettext "inventory.txt")" 5 | gsh check 6 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/03_stdout_redirection_inventory/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | rm -f "$GSH_TMP/inventory_grimoires" 4 | ( 5 | cd "$(eval_gettext '$GSH_HOME/Castle/Main_building/Library/Merlin_s_office')" 6 | chmod +r "$(gettext "grimoire")_"* 7 | ) 8 | 9 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/03_stdout_redirection_inventory/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext '$GSH_HOME/Castle/Main_building/Library/Merlin_s_office')/$(gettext "Drawer")" 4 | sign_file "$MISSION_DIR/ascii-art/candle.txt" "$(eval_gettext '$GSH_HOME/Castle/Main_building/Library/Merlin_s_office')/$(gettext "candle")" 5 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/04_stderr_dev-null_grimoires/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | . alt_history_start.sh 4 | 5 | cd "$(eval_gettext '$GSH_HOME/Castle/Main_building/Library/Merlin_s_office')" 6 | 7 | add_cmd 'grep -il "gsh" "$(gettext "grimoire")"_* 2> /dev/null' 8 | grep -il "gsh" "$(gettext "grimoire")"_* 2> /dev/null 9 | add_cmd gsh check 10 | gsh check 11 | 12 | . alt_history_stop.sh 13 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/04_stderr_dev-null_grimoires/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | 4 | if [ -f "$GSH_TMP/list_grimoires-R" ] 5 | then 6 | while IFS= read file 7 | do 8 | rm "$file" 9 | done < "$GSH_TMP/list_grimoires-R" 10 | fi 11 | unset file 12 | rm -f "$GSH_TMP/list_grimoires-R" 13 | rm -f "$GSH_TMP/list_grimoires_GSH" 14 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/04_stderr_dev-null_grimoires/i18n/template.pot: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "Content-Type: text/plain; charset=UTF-8\n" 3 | "Content-Transfer-Encoding: 8bit\n" 4 | 5 | #, sh-format 6 | msgid "$GSH_HOME/Castle/Main_building/Library/Merlin_s_office" 7 | msgstr "" 8 | 9 | # path for the text file containing the goal 10 | msgid "$MISSION_DIR/goal/en.txt" 11 | msgstr "" 12 | 13 | # path for the text file containing the skip message 14 | msgid "$MISSION_DIR/skip/en.txt" 15 | msgstr "" 16 | 17 | # path for the text file containing the treasure message 18 | msgid "$MISSION_DIR/treasure-msg/en.txt" 19 | msgstr "" 20 | 21 | msgid "Your previous command doesn't use the 'grep' command..." 22 | msgstr "" 23 | 24 | msgid "grimoire" 25 | msgstr "" 26 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/04_stderr_dev-null_grimoires/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext '$GSH_HOME/Castle/Main_building/Library/Merlin_s_office')" 4 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/04_stderr_dev-null_grimoires/test.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | . alt_history_start.sh 4 | 5 | cd "$(eval_gettext '$GSH_HOME/Castle/Main_building/Library/Merlin_s_office')" 6 | 7 | add_cmd 'grep -i gsh "$(gettext "grimoire")"_*' 8 | add_cmd 'gsh check' 9 | gsh assert check false 10 | 11 | add_cmd 'grep -il gsh "$(gettext "grimoire")"_*' 12 | add_cmd 'gsh check' 13 | gsh assert check false 14 | 15 | chmod a+r "$(gettext "grimoire")"_* 16 | add_cmd 'grep -il gsh "$(gettext "grimoire")"_*' 17 | add_cmd 'gsh check' 18 | gsh assert check false 19 | 20 | add_cmd 'grep -il gsh "$(gettext "grimoire")"_* 2>/dev/null' 21 | add_cmd 'gsh check' 22 | gsh assert check true 23 | 24 | . alt_history_stop.sh 25 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/05_stdout_stderr_redirection_merlin/auto.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | key=$(mktemp) 4 | "$(eval_gettext '$GSH_HOME/Castle/Observatory')"/merlin 2>"$key" 5 | 6 | gsh check <"$key" 7 | rm -f "$key" 8 | 9 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/05_stdout_stderr_redirection_merlin/check.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | _mission_check() ( 4 | secret=$(cat "$GSH_TMP/secret_key") 5 | 6 | printf "%s " "$(gettext "What is the secret key?")" 7 | read -r r 8 | 9 | if [ "$secret" != "$r" ] 10 | then 11 | echo "$(gettext "That's not the correct key!")" 12 | return 1 13 | fi 14 | 15 | if [ -t 0 ] 16 | then 17 | # got input interactively from a tty 18 | echo "$(gettext "That's correct, but you need to use a redirection to complete this mission!")" 19 | return 1 20 | fi 21 | return 0 22 | ) 23 | 24 | _mission_check 25 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/05_stdout_stderr_redirection_merlin/clean.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | rm -f "$GSH_TMP/secret_key" "$GSH_TMP/merlin" 4 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/05_stdout_stderr_redirection_merlin/static.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | mkdir -p "$(eval_gettext '$GSH_HOME/Castle/Observatory')" 4 | sign_file "$MISSION_DIR/ascii-art/moon.txt" "$(eval_gettext '$GSH_HOME/Castle/Observatory')/$(gettext "star_chart")" 5 | -------------------------------------------------------------------------------- /missions/stdin_stdout_stderr/default.idx: -------------------------------------------------------------------------------- 1 | 01_stdin_additions 2 | 02_stdin_redirection_multiplications 3 | 03_stdout_redirection_inventory 4 | 04_stderr_dev-null_grimoires 5 | 05_stdout_stderr_redirection_merlin 6 | -------------------------------------------------------------------------------- /scripts/_gsh_log: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | GSH_ROOT=$(cd "$(dirname "$0")/.." && pwd -P) 4 | 5 | # we need access to checksum and missiondir 6 | PATH=$PATH:$GSH_ROOT/scripts 7 | 8 | if [ "$1" = "-v" ] 9 | then 10 | VERBOSE=1 11 | shift 12 | fi 13 | 14 | awk -v UID="$(cat "$GSH_ROOT/.config/uid")" \ 15 | -v VERBOSE="$VERBOSE" \ 16 | -v MISSION_NB="$1" \ 17 | -f "$GSH_ROOT/scripts/_gsh_log.awk" \ 18 | "$GSH_ROOT/.config/missions.log" 19 | -------------------------------------------------------------------------------- /scripts/_gsh_pcm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # pcm => "print current mission" 4 | GSH_CONFIG=$(cd "$(dirname "$0")/../.config"; pwd -P) 5 | 6 | pcm() { 7 | # NOTE: auto-save takes place after "CHECK_OK", but before STARTing the next mission, so we need to take that into account 8 | PCM="$(awk '/^#/ {next} $2=="START" {m=$1} $2=="CHECK_OK" {m=$1+1} END {print (m)}' "$GSH_CONFIG/missions.log")" 9 | if [ -z "$PCM" ] 10 | then 11 | echo "1" 12 | return 1 13 | else 14 | echo "$PCM" 15 | fi 16 | } 17 | 18 | pcm "$@" 19 | -------------------------------------------------------------------------------- /scripts/_gsh_plm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # pcm => "print last mission" 4 | GSH_CONFIG=$(cd "$(dirname "$0")/../.config"; pwd -P) 5 | 6 | pcm() { 7 | PCM="$(awk '/^#/ {next} $2=="START" {m=$1>m ? $1 : m} END {print (m)}' "$GSH_CONFIG/missions.log")" 8 | if [ -z "$PCM" ] 9 | then 10 | echo "1" 11 | return 1 12 | else 13 | echo "$PCM" 14 | fi 15 | } 16 | 17 | pcm "$@" 18 | -------------------------------------------------------------------------------- /scripts/_gsh_protect: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | chmod a-rw "$GSH_ROOT" 4 | chmod a-rw "$GSH_MISSIONS" 5 | chmod a-r "$GSH_CONFIG" 6 | chmod a-r "$GSH_TMP" 7 | chmod a-rw "$GSH_SBIN" 8 | -------------------------------------------------------------------------------- /scripts/_gsh_stat: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | GSH_ROOT=$(cd "$(dirname "$0")/.." && pwd -P) 4 | 5 | # we need access to checksum and missiondir 6 | PATH=$PATH:$GSH_ROOT/scripts 7 | 8 | awk -v UID="$(cat "$GSH_ROOT/.config/uid")" \ 9 | -f "$GSH_ROOT/scripts/_gsh_stat.awk" \ 10 | "$GSH_ROOT/.config/missions.log" 11 | -------------------------------------------------------------------------------- /scripts/_gsh_systemconfig: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # display some info about the system 4 | echo "=========================" 5 | echo "GSH_SHELL=$GSH_SHELL" 6 | case "$GSH_SHELL" in 7 | *zsh | *bash) 8 | echo "version" 9 | $GSH_SHELL --version | head -n1 10 | ;; 11 | esac 12 | echo "=========================" 13 | echo "uname -a" 14 | uname -a 15 | echo "=========================" 16 | echo "awk --version" 17 | (awk -Wversion 2>/dev/null || awk --version 2>/dev/null || awk -V 2>/dev/null) | head -n1 18 | echo "=========================" 19 | echo "locale" 20 | locale 21 | echo "=========================" 22 | -------------------------------------------------------------------------------- /scripts/_gsh_unprotect: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | chmod "$(umask -S)" "$GSH_ROOT" 4 | chmod "$(umask -S)" "$GSH_MISSIONS" 5 | chmod "$(umask -S)" "$GSH_CONFIG" 6 | chmod "$(umask -S)" "$GSH_TMP" 7 | chmod "$(umask -S)" "$GSH_SBIN" 8 | -------------------------------------------------------------------------------- /scripts/_gsh_version: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | . gsh_gettext.sh 4 | 5 | GSH_VERSION='developpment version' 6 | 7 | echo "Gameshell $GSH_VERSION" 8 | 9 | echo 10 | 11 | echo $(gettext "The latest version of Gameshell is available at") 12 | echo " https://github.com/phyver/GameShell" 13 | -------------------------------------------------------------------------------- /scripts/_gsh_welcome: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | . gsh_gettext.sh 4 | 5 | welcome() { 6 | # display welcome message 7 | msg_file=$(eval_gettext '$GSH_ROOT/i18n/gameshell-welcome/en.txt') 8 | [ -r "$msg_file" ] || return 1 9 | parchment "$msg_file" | pager 10 | } 11 | welcome "$@" 12 | -------------------------------------------------------------------------------- /scripts/checksum: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # computes a checksum of a string 4 | # with no argument, reads the string from STDIN 5 | 6 | # Linux 7 | if command -v sha1sum > /dev/null 2>&1 8 | then 9 | if [ "$#" -eq 0 ] 10 | then 11 | sha1sum | cut -c 1-40 12 | else 13 | printf "%s" "$*" | sha1sum | cut -c 1-40 14 | fi 15 | 16 | # macos 17 | elif command -v shasum -a 1 > /dev/null 2>&1 18 | then 19 | if [ "$#" -eq 0 ] 20 | then 21 | shasum -a 1 | cut -c 1-40 22 | else 23 | printf "%s" "$*" | shasum -a 1 | cut -c 1-40 24 | fi 25 | 26 | # bsd 27 | elif command -v sha1 > /dev/null 2>&1 28 | then 29 | if [ "$#" -eq 0 ] 30 | then 31 | sha1 | cut -c 1-40 32 | else 33 | printf "%s" "$*" | sha1 | cut -c 1-40 34 | fi 35 | fi 36 | 37 | -------------------------------------------------------------------------------- /scripts/color_echo: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | case "$1" in 4 | black | bk) color=0; shift;; 5 | red | r) color=1; shift;; 6 | green | g) color=2; shift;; 7 | yellow | y) color=3; shift;; 8 | blue | b) color=4; shift;; 9 | magenta | m) color=5; shift;; 10 | cyan | c) color=6; shift;; 11 | white | w) color=7; shift;; 12 | *) color=7;; 13 | esac 14 | 15 | if [ -n "$GSH_COLOR" ] 16 | then 17 | trap "tput sgr0 2>/dev/null" TERM INT 18 | tput setaf $color 2>/dev/null 19 | echo "$@" 20 | tput sgr0 2>/dev/null 21 | else 22 | echo "$@" 23 | fi 24 | 25 | -------------------------------------------------------------------------------- /scripts/generate_rcfile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | . gsh_gettext.sh 4 | 5 | [ -d "$GSH_HOME" ] || { echo "Error: GSH_HOME doesn't exists" >&2 ; exit 1 ; } 6 | 7 | msg=$(gettext "AUTOMATICALLY GENERATED ON STARTUP -- DO NOT MODIFY") 8 | case "$GSH_SHELL" in 9 | *bash) 10 | cat <"$GSH_HOME/.bashrc" 11 | # $msg 12 | source "$GSH_LIB/bashrc" 13 | source "$GSH_LIB/gshrc" 14 | __gsh_start 15 | EOF 16 | ;; 17 | *zsh) 18 | # NOTE: keep the files in this order, as zshrc sets some options that 19 | # are necessary for gsh.sh (sourced from gshrc) to work, in particular, 20 | # the POSIX_TRAPS option that makes trapping EXIT work like in bash 21 | cat <"$GSH_HOME/.zshrc" 22 | # $msg 23 | source "$GSH_LIB/zshrc" 24 | source "$GSH_LIB/gshrc" 25 | __gsh_start 26 | EOF 27 | ;; 28 | esac 29 | -------------------------------------------------------------------------------- /scripts/gsh_gettext.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | if [ -z "$GSH_NO_GETTEXT" ] 4 | then 5 | . gettext.sh 2>/dev/null 6 | fi 7 | 8 | if ! command -v eval_gettext >/dev/null 9 | then 10 | 11 | export GSH_NO_GETTEXT=1 12 | 13 | gettext() { 14 | echo "$1" 15 | } 16 | 17 | ngettext() { 18 | echo "$2" 19 | } 20 | 21 | eval_gettext() { 22 | eval "echo \"$1\"" 23 | } 24 | 25 | fi 26 | -------------------------------------------------------------------------------- /scripts/mainshell.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | # this file must be SOURCED, it will return 0 (true) if the current PID is the 4 | # same as $$, and 1 (false) otherwise 5 | # cf https://unix.stackexchange.com/questions/484442/how-can-i-get-the-pid-of-a-subshell 6 | 7 | test "$( exec sh -c 'echo $PPID' )" = "$$" 8 | -------------------------------------------------------------------------------- /scripts/missiondir: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | GSH_ROOT=$(cd "$(dirname "$0")/.." && pwd -P) 4 | GSH_MISSIONS=$GSH_ROOT/missions 5 | GSH_CONFIG=$GSH_ROOT/.config 6 | 7 | if [ "$1" = "-r" ] 8 | then 9 | RELATIVE=1 10 | shift 11 | fi 12 | 13 | # get the mission directory 14 | n=$1 15 | dir=$(awk -v n="$n" -v DIR="$GSH_MISSIONS" '/^\s*[#!]/{next} /^$/{next} {N++} (N == n){print DIR "/" $0; exit}' "$GSH_CONFIG/index.idx") 16 | if [ -z "$dir" ] 17 | then 18 | echo "Error: missiondir, mission '$n' not found." >&2 19 | exit 1 20 | fi 21 | dir=$(readlink-f "$dir") 22 | 23 | if [ -z "$RELATIVE" ] 24 | then 25 | echo "$dir" 26 | else 27 | echo "${dir#$GSH_MISSIONS/}" 28 | fi 29 | 30 | 31 | -------------------------------------------------------------------------------- /scripts/mktemp: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | GSH_ROOT="$(cd "$(dirname "$0")/.." && pwd -P)" 4 | PATH=$PATH:"$GSH_ROOT/scripts" 5 | 6 | # create a temporary file in $TMPDIR 7 | if [ -z "$TMPDIR" ] 8 | then 9 | TMPDIR="$GSH_ROOT/.tmp" 10 | if ! [ -d "$TMPDIR" ] 11 | then 12 | mkdir "$TMPDIR" 13 | fi 14 | fi 15 | 16 | FILE="" 17 | for _ in $(seq 10) 18 | do 19 | FILE="$TMPDIR/tmp.$(RANDOM)$(RANDOM)" 20 | if [ -e "$FILE" ] 21 | then 22 | FILE="" 23 | continue 24 | else 25 | touch "$FILE" 26 | break 27 | fi 28 | done 29 | 30 | if [ -z "$FILE" ] 31 | then 32 | false 33 | else 34 | echo "$FILE" 35 | true 36 | fi 37 | -------------------------------------------------------------------------------- /scripts/pager: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | TEXTDOMAIN=gsh 4 | 5 | if [ -n "$GSH_NON_INTERACTIVE" ] 6 | then 7 | cat "$@" 8 | elif [ -n "$PAGER" ] 9 | then 10 | $PAGER "$@" 11 | elif command -v less > /dev/null 2>&1 12 | then 13 | LESS= less -rEX -Ps"$(gettext '[Press space to continue, 'q' to quit\.]')$" \ 14 | -Pm"$(gettext '[Press space to continue, 'q' to quit\.]')$" \ 15 | -PM"$(gettext '[Press space to continue, 'q' to quit\.]')$" \ 16 | "$@" 17 | else 18 | more "$@" 19 | fi 20 | 21 | -------------------------------------------------------------------------------- /scripts/rm: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | GSH_ROOT=$(cd "$(dirname "$0")/.." && pwd -P) 4 | 5 | SAFE_RM=1 6 | 7 | if [ "$#" -ge 1 ] && [ "$1" = "--system" ] 8 | then 9 | shift 10 | SAFE_RM=0 11 | fi 12 | 13 | if [ "$SAFE_RM" -eq 1 ] 14 | then 15 | for arg in "$@" 16 | do 17 | case "$arg" in 18 | -*) 19 | continue 20 | ;; 21 | esac 22 | case "$("$GSH_ROOT"/scripts/readlink-f "$arg")" in 23 | "$GSH_ROOT"*) 24 | continue 25 | ;; 26 | *) 27 | echo "safe_rm: cannot remove '$arg': it is not part of GameShell" >&2 28 | exit 1 29 | ;; 30 | esac 31 | done 32 | fi 33 | 34 | PATH="${ORIGINAL_PATH}" rm "$@" 35 | 36 | -------------------------------------------------------------------------------- /scripts/sed-i: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ## posix way to do sed "in place" 4 | 5 | # NOTE: we add the "--system" flag to rm to bypass checks made by the "safe" 6 | # rm scritp in script/rm 7 | # 8 | sed_i() { 9 | if [ $# -gt 2 ] 10 | then 11 | echo "usage: sed-i 'EXPRESSION' FILENAME" >&2 12 | return 1 13 | fi 14 | expr=$1 15 | filename=$2 16 | tmp=$(mktemp) 17 | bak="$filename~" 18 | trap "rm --system -f \"$tmp\" \"$bak\"" TERM INT 19 | if sed -e "$expr" "$filename" > "$tmp" 20 | then 21 | cp "$filename" "$bak" 22 | trap "" TERM INT 23 | cp "$tmp" "$filename" 24 | rm --system -f "$tmp" "$bak" 25 | else 26 | ret=$? 27 | rm --system -f "$tmp" "$bak" 28 | return $ret 29 | fi 30 | } 31 | 32 | sed_i "$@" 33 | -------------------------------------------------------------------------------- /scripts/text_size.awk: -------------------------------------------------------------------------------- 1 | BEGIN { 2 | width = 0; 3 | } 4 | 5 | { 6 | w = wcscolumns($0); 7 | if (width < w) { 8 | width = w; 9 | } 10 | } 11 | 12 | END { 13 | print width, NR; 14 | } 15 | 16 | -------------------------------------------------------------------------------- /scripts/textdomainname: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | GSH_ROOT=$(cd "$(dirname "$0")/.." && pwd -P) 4 | "$GSH_ROOT/scripts/missionname" "$1" | sed 's|/|,|g' 5 | --------------------------------------------------------------------------------