Giter Site home page Giter Site logo

samalws / ch Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 17 KB

a tool that lets you choose files/folders in the shell without using tab or ls (good for minimalist shells like dash :) )

License: GNU General Public License v3.0

Shell 100.00%

ch's Introduction

ch (choose)

a tool that lets you choose files/folders in the shell without using tab or ls

prints the user interaction parts with stdErr instead of stdOut so you can use stdOut in commands to select stuff (see examples below)

examples:

run directly:

$ ch
1 . 2 .. 3 aFile 4 aFolder
$ 4
1 . 2 .. 3 anotherFile
$ 3
./aFolder/anotherFile

use in another command:

$ cat $(ch)
1 . 2 .. 3 aFile 4 aFolder
$ 4
1 . 2 .. 3 anotherFile
$ 3
this is the text that's in anotherFile

select a folder:

$ ls -l $(ch)
1 . 2 .. 3 aFile 4 aFolder
$ 4
1 . 2 .. 3 anotherFile
$ 1
total 4
-rw-r--r-- 1 uwe uwe 39 Jun 16 17:16 anotherFile

works with cd:

$ cd $(ch)
1 . 2 .. 3 aFile 4 aFolder
$ 4
1 . 2 .. 3 anotherFile
$ 1
ls -l
total 4
-rw-r--r-- 1 uwe uwe 39 Jun 16 17:16 anotherFile

choose a file by number if you know it already:

$ ls $(ch -n 4)
anotherFile

choose from a directory other than pwd:

$ ls $(ch /)
1 . 2 .. 3 bin 4 boot 5 dev 6 etc 7 home 8 iface 9 lib 10 lib32 11 lib64 12 media 13 mnt 14 opt 15 proc 16 root 17 run 18 sbin 19 sys 20 tmp 21 usr 22 var
$ 7
1 . 2 .. 3 uwe
$ 1
uwe

move up a directory:

$ ch /home
1 . 2 .. 3 uwe
$ 2
1 . 2 .. 3 bin 4 boot 5 dev 6 etc 7 home 8 iface 9 lib 10 lib32 11 lib64 12 media 13 mnt 14 opt 15 proc 16 root 17 run 18 sbin 19 sys 20 tmp 21 usr 22 var
$ 7
1 . 2 .. 3 uwe
$ 1
/home/../home

add quotes when choosing something with spaces in its name:

$ ls "$(ch ..)"
1 . 2 .. 3 a b c
$ 3
1 . 2 .. 3 aFile 4 aFolder
$ 1
aFile aFolder

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.