Better HN
topnewbestaskshowjobs
Log inSign up

killeik

1 karma · joined Sep 5, 2024 (2y ago) · 1 submissions

Submissions

comment 2y ago · link · parent

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