News for hackers. Stuff that matters.
Re:Show HN: lscat – ls for directories, cat for files by killeik on Thursday October 03, 2024 @12:34PM (#41732306)
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
Re:Show HN: lscat – ls for directories, cat for files by nahco314 on Thursday October 03, 2024 @01:56PM (#41733087)
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.
Re:Show HN: lscat – ls for directories, cat for files by jas39 on Friday October 04, 2024 @04:20PM (#41745201)
Great idea! It can be a package, but it should be a shellscript, I think.