https://github.com/tomhrr/cosh Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code + Explore + All features + Documentation + GitHub Skills + Blog * Solutions + For + Enterprise + Teams + Startups + Education + By Solution + CI/CD & Automation + DevOps + DevSecOps + Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles + Repositories + Topics + Trending + Collections * Pricing [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} tomhrr / cosh Public * Notifications * Fork 1 * Star 52 Concatenative command-line shell License BSD-3-Clause license 52 stars 1 fork Star Notifications * Code * Issues 2 * Pull requests 0 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights tomhrr/cosh This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 1 branch 1 tag Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/t] Use Git or checkout with SVN using the web URL. [gh repo clone tomhrr] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @tomhrr tomhrr [main] Fix test issue (2). ... 52a05c2 Jan 17, 2023 [main] Fix test issue (2). 52a05c2 Git stats * 289 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time .github/workflows [main] Try update. Oct 1, 2022 bin [gh-21] Document benchmark programs, fix implicit call problem, add / ... Aug 4, 2022 doc [main] Remove benchmark content for now, since the results are not co... Jan 10, 2023 lib [main] Miscellaneous fixes and documentation updates. Jan 10, 2023 src [main] Fix problem with command output collection. Jan 17, 2023 test-data [main] Handle big integers properly when parsing JSON (closes #5). Jan 28, 2022 test-misc [main] Fix problem with command output collection. Jan 17, 2023 tests [main] Fix test issue (2). Jan 17, 2023 .gitignore [gh-11-t2] gitignore updates. Jul 3, 2022 Cargo.toml [gh-43] Add basic hashing functions. Jan 5, 2023 LICENCE [main] Initial commit. Jan 8, 2022 Makefile [main] Use the libdir from the Makefile when loading rt.chc. Jan 11, 2023 README.md [main] Documentation updates. Jan 11, 2023 View code [ ] cosh Why? Install Dependencies Supported systems Building Running Documentation Licence README.md cosh Build Status stability-beta cosh is a concatenative command-line shell. Why? Basic shell operations like ls, ps, stat, and so on are implemented as functions that return first-class values, as opposed to relying on executables that return text streams. This makes working with the results simpler: * Find files matching a path, and search them for data: + sh: find . -iname '*test*' -print0 | xargs -0 grep data + cosh: lsr; [test m] grep; [f<; [data m] grep] map * Find the total size of all files in the current directory: + sh: ls | xargs stat -c %s | awk '{s+=$1} END {print s}' - + cosh: ls; [is-dir; not] grep; [stat; size get] map; sum A small set of versatile primitives means that less needs to be remembered when compared with typical shells (see e.g. the various flags for cut(1)), though some commands may be longer as a result: * Get the second and third columns from each row of a CSV file: + sh: cut -d, -f2,3 test-data/csv + cosh: test-data/csv f<; [chomp; , split; (1 2) get] map * Sort files by modification time: + sh: ls -tr + cosh: ls; [[stat; mtime get] 2 apply; <=>] sortp Arithmetical operators and XML/JSON/CSV encoding/decoding functions reduce the number of times that it becomes necessary to use a more full-featured programming language or a third-party executable: * Increment floating-point numbers in file: + sh: sed 's/$/+10/' nums | bc + cosh: nums f<; [chomp; 10 +] map; * Get the first value from the "zxcv" array member of a JSON file: + sh: jq .zxcv[0] test-data/json2 + cosh: test-data/json2 f<; from-json; zxcv get; 0 get It also integrates with external executable calls, where that is necessary: * Print certificate data: + bash: for i in `find . -iname '*.pem'`; do openssl x509 -in $i -text -noout; done + cosh: lsr; [pem$ m] grep; [{openssl x509 -in {} -text -noout}] map; Install Dependencies * Rust Supported systems This has been tested on Linux (Debian 12), but should work on any Linux/macOS/BSD system where Rust can be built. Building make make test sudo make install Apart from the core cosh executable, this will also install a compiled library of core functions (rt.chc). Running user@host:/$ cosh /$ hello println; hello Documentation Documentation Licence See LICENCE. About Concatenative command-line shell Resources Readme License BSD-3-Clause license Stars 52 stars Watchers 2 watching Forks 1 fork Releases 1 tags Packages 0 No packages published Languages * Rust 97.7% * xBase 2.2% * Other 0.1% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.