1

Where is the 'line' utility gone that was in /usr/bin/line ? I understand that the bash 'read' builtin is an alternative but I have many uses of line in shell scripts and don't like to touch all those. Maybe it is in a package not installed by default, but cannot find it. Thanks for hints.

5
  • 2
    It was part of util-linux, but doesn’t seem to be provided any more with 17.10+. :/
    – dessert
    Jun 18, 2018 at 7:36
  • You could write your own script (something like read line; echo $line) and put that in /usr/bin/line. Then your scripts will work again.
    – Jos
    Jun 18, 2018 at 7:44
  • @Jos It would be IFS= read -r line; echo "$line". And it would be better to use /usr/local/bin/line, no?
    – wjandrea
    Jun 18, 2018 at 20:17
  • Well, I tried to give a basic idea of a solution. But you are right on both accounts.
    – Jos
    Jun 18, 2018 at 20:37
  • Probably a good way would be to make util-linux a dependency for your scripts, that is in the beginning of the script check if util-linux package is installed, and if not - run apt-get install util-linux. Alternatively, make your own "library" of functions, one of which would be what Jos and wjandrea suggested, and let your scripts source that library. Besides, read is more portable - what if you need to use the scripts on HP-UX or Aix or Solaris in future ? That is, make everything POSIX-compliant. Jun 19, 2018 at 2:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.