Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
Show HN: lscat – ls for directories, cat for files | Better HN
Show HN: lscat – ls for directories, cat for files
(opens in new tab)
(github.com)
3 points
nahco314
1y ago
3 comments
Share
3 comments
default
newest
oldest
killeik
1y ago
I'm sure this should not be done as a separate package, but as a simple function in .bashrc/.zshrc
lscat(){ if [ -d $1 ]; then ls $1 elif [ -f $1 ]; then cat $1 else echo "$1 is not valid path" fi }
Similarly, you can also use alias ls=lscat
nahco314
OP
1y ago
I created independent binary for the sake of using the same thing in bash/fish/powershell and for the ease of adding functions, but for simple use, that way would be better.
jas39
1y ago
Great idea! It can be a package, but it should be a shellscript, I think.
j
/
k
navigate · click thread line to collapse