{"id":13339649,"url":"https://github.com/niinpatel/basic-shell-scripting","last_synced_at":"2026-03-05T13:17:22.861Z","repository":{"id":96105475,"uuid":"136503373","full_name":"niinpatel/basic-shell-scripting","owner":"niinpatel","description":"If statements, While loops, Switch Case, Random Numbers and More using shell scripting. ","archived":false,"fork":false,"pushed_at":"2020-11-01T17:48:23.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-24T02:31:35.323Z","etag":null,"topics":["bash","scripting","shell","unix"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/niinpatel.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":"https://paypal.me/PayNitin"}},"created_at":"2018-06-07T16:22:26.000Z","updated_at":"2020-11-01T17:48:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"892ce4dc-a9f5-4b8a-a83d-d5c037b4e089","html_url":"https://github.com/niinpatel/basic-shell-scripting","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niinpatel%2Fbasic-shell-scripting","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niinpatel%2Fbasic-shell-scripting/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niinpatel%2Fbasic-shell-scripting/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/niinpatel%2Fbasic-shell-scripting/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/niinpatel","download_url":"https://codeload.github.com/niinpatel/basic-shell-scripting/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243051978,"owners_count":20228304,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","scripting","shell","unix"],"created_at":"2024-07-29T19:21:07.940Z","updated_at":"2026-03-05T13:17:22.806Z","avatar_url":"https://github.com/niinpatel.png","language":"Shell","funding_links":["https://paypal.me/PayNitin"],"categories":[],"sub_categories":[],"readme":"# basic-shell-scripting\n\n\u003e /* About [SL Package](https://github.com/mtoyoda/sl)\n\n\u003e    This package creates a steam locomotive animation on the terminal whenever you enter commands like sl or LS or any other misspelling or ls command. \n     (Works only for Linux).\n*/ \n\nThis program runs different steam locomotives continuously on your terminal.\n\n![alt demo](https://i.imgur.com/2OG2r80.gif)\n\n__Use of :__ \n\n\n* [if then statements](https://www.tutorialspoint.com/unix/if-elif-statement.htm) \n* [dpkg commands](https://linuxconfig.org/how-to-test-for-installed-package-using-shell-script-on-ubuntu-and-debian) \n* [while loop](https://www.tutorialspoint.com/unix/while-loop.htm) \n* [switch esac](https://www.tutorialspoint.com/unix/case-esac-statement.htm)\n* [variable declaration](https://www.tutorialspoint.com/unix/unix-using-variables.htm)\n* [random numbers generation.](https://blog.eduonix.com/shell-scripting/generating-random-numbers-in-linux-shell-scripting/) \n\n\n__What it does.__ \n\nThis is the basic shell scripting program which contains basic programming commands like *if statements*, *while loop*, *switch case* and more. \n\nHere's the brief explanation of what is happening. \n\nto run this script correctly, user needs to have [sl](https://github.com/mtoyoda/sl) installed in his computer, so the first thing this program does is to check if *sl* is installed or not. \n\nwe do this using an *if* then statement and a *dkpg* query. If the package is not there, it will install the package in automatically. \n\nNext, if creates a *while loop* which runs forever. this can be achieved using while true; command. \n\ninside the while loop, i will declare and initialize a variable called *train_number* and assign it a random number between 1 and 3. \n\nThen I will use a *switch* statement. We will call a random train based on the number that is in the *train_number* variable. \n\nfinally we close the switch statement and while loop with *esac* and *done* respectively. \n\nTo run the script, clone into the repo and then type the following command on the terminal: \n\n\n\n    ./simplebash.sh\n    \n    \nThis should start the script. To end it, you can just close the terminal.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniinpatel%2Fbasic-shell-scripting","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fniinpatel%2Fbasic-shell-scripting","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fniinpatel%2Fbasic-shell-scripting/lists"}