Guest User

Untitled

a guest
Jun 18th, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. #!/bin/bash
  2. # CONKY Task Manager
  3.  
  4. width=55
  5. shortwidth=$(( $width - 3 ))
  6.  
  7. # Set the field seperator to a newline
  8. IFS="
  9. "
  10.  
  11. # Loop through the file
  12. linenum=0
  13. for line in `cat $1`;do
  14. linenum=$(( $linenum + 1 ))
  15. # echo $linenum
  16. if [ $linenum -gt 2 ] ; then
  17. count=`echo $line |wc -c`
  18. # echo $count
  19. if [ $count -gt $width ]; then
  20. temp=${line:0:$shortwidth}
  21. echo $temp...
  22. elif [ $count -lt $width ]; then
  23. echo $line
  24. fi
  25. else
  26. temp=${line:0:$width}
  27. echo $temp
  28. fi
  29. done
Add Comment
Please, Sign In to add comment