{"id":17021419,"url":"https://github.com/uliwitness/dans-shell","last_synced_at":"2026-05-05T06:32:18.289Z","repository":{"id":136633768,"uuid":"56346999","full_name":"uliwitness/dans-shell","owner":"uliwitness","description":"A simple toy shell that's supposed to be more like a real programming language, less like a search-and-replace program with side effects.","archived":false,"fork":false,"pushed_at":"2016-05-11T09:37:17.000Z","size":74,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-27T20:43:33.265Z","etag":null,"topics":["experiment","shell"],"latest_commit_sha":null,"homepage":null,"language":"C++","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/uliwitness.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2016-04-15T20:11:27.000Z","updated_at":"2016-04-16T12:43:25.000Z","dependencies_parsed_at":null,"dependency_job_id":"da4d2a68-4f75-4196-a6d9-ef8c2553ed33","html_url":"https://github.com/uliwitness/dans-shell","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/uliwitness%2Fdans-shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uliwitness%2Fdans-shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uliwitness%2Fdans-shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uliwitness%2Fdans-shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uliwitness","download_url":"https://codeload.github.com/uliwitness/dans-shell/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244992102,"owners_count":20543751,"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":["experiment","shell"],"created_at":"2024-10-14T07:07:36.568Z","updated_at":"2026-05-05T06:32:18.218Z","avatar_url":"https://github.com/uliwitness.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"#Dan's Shell\n\n##Concept\n\nThe idea behind Dan's Shell is to provide a simple, familiar and regular syntax that\nencourages correct and secure code. In particular, the desire is to make it impossible\nto incorrectly quote variables and cause them to be executed, or to cause empty/undefined\nvariables to quietly disappear, causing parameter labels to be interpreted as values or\ncausing two concatenated paths to be interpreted as \"/\" and thus delete your hard disk\nor whatever.\n\n\n##Syntax\n\nTo call a command, use the general syntax\n\n\tname( param1, param2, param3 )\n\nWhere name can be a package name consisting of several identifiers separated by dots.\nIf there are no parameters, you can leave away the brackets as well, or you can specify\nempty brackets, as you wish. For the outermost statement on a line, you can even leave\naway the brackets, so it looks almost like Bash or other shell languages.\n\n\t(functionReturningName())( param1, param2, param3 )\n\nIf you want to build the name of a command using code (e.g. to generate the pathname for\nan executable), you replace the name in your function call with the expression in brackets.\n\nCurrently, four kinds of values are supported:\n\n\t\"Quoted String\"\n\nStrings delimited by double quotes. These may contain spaces. Like C, you can use\nthe backslash to escape characters in a string. E.g. to write a quote in your\nstring, write \\\" so the quote will become part of the string instead of ending it.\nYou can also specify \\n to indicate a Unix line break (ASCII 10) and \\r to indicate\na carriage return (ASCII 13, classic MacOS line break). For a Windows line break,\n\\r\\n would work. \\t will produce a tab character (ASCII 9).\n\n\t123.45\n\t\nNumber. A number can consist only of numeric characters and may optionally contain\na decimal point.\n\n\t$myVariable\n\nA variable local to this shell. You can use the assignment operator to assign\na value to this variable, like so:\n\n\t$myVariable = 15\n\nIn addition, equivalent syntax is provided that looks more Dan's Shell-ish:\n\n\tvar.myVariable\n\nThis is consistent with environment variables, which are passed on to\ncommands that are executed and are referenced by writing:\n\n\tenv.PATH\n\n(to get the \"PATH\" environment variable, for example)\n\n\tname( -label \"paramOne\", --label2, \"param3\" )\n\nWhile Dan's Shell requires commas between parameters, it has a special understanding of parameter labels. A label is an identifier that starts with a dash or two dashes, which is passed verbatim as if it was a string as a parameter to the called executable. Usually, command line tools use labels either to indicate what parameter is to follow (in the above case that \"paramOne\" is a label), or as switches whose presence indicates what the program is to do (like \"--label2\" above).\n\n\tname( \"-label\", \"paramOne\", \"--label2\", \"param3\" )\n\nis 100% equivalent to the above labeled command, just that it's less arduous to type. Similarly, since you can leave out the brackets, you can end up at near-Bash-syntax:\n\n\tname -label \"paramOne\", --label2, \"param3\"\n\n\n\n\n##Built-in commands\n\nCurrently, the built-in commands are:\n\n\tpwd()\n\nOutput the current working directory. Another way to write this command is\n\n\t.\n\nor even\n\n\t.()\n\nWhich has the same effect.\n\n\t..\n\nsimilarly returns the directory containing the current directory, so that is the same as pwd() but with the last path component removed.\n\n\t~\n\nIs also a valid function, and returns the current user's home directory.\n\n\tcd( path )\n\nChange the current working directory to the given path, specified as a string.\n\n\twhich( \"pathOrCommandName\" )\n\nReturns the full path of the executable that Dan's Shell will run if you invoke the given command. This will for example look up the search paths in the PATH environment variable and check if a command of which only the name has been specified exists there. Note that you must put the name of the desired command in quotes, otherwise the command will be executed and which() will try to find a tool named like the result of that command.\n\n\techo( \"text\" )\n\nLogs all its arguments to standard output, followed by a line break.\n\n\tsource( \"/path/to/file\" )\n\nRuns the given Dan's Shell script in the context of the current shell. This lets you pre-define variables etc.\n\n\texit()\n\nQuit Dan's Shell.\n\n\t# This is a comment\n\nTo add comments to a line (most useful when running scripts), use the \"#\" character. Everything\nstarting with the \"#\" character to the end of the line will be ignored.\n\n\n##Shell Scripts\n\nDan's Shell is suitable for running shell scripts. Just pipe them into dansh's stdin, like\nyou would do for any other shell. You can of course also start a script text file with a\nshebang to have the OS automatically run it in Dan's Shell.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuliwitness%2Fdans-shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuliwitness%2Fdans-shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuliwitness%2Fdans-shell/lists"}