DISQUS

Tech-Recipes: bash shell script iterate through array values | Bourne shell scripting | Tech-Recipes

  • Fakeer · 1 year ago
    all kinds of errors will popup if you write this (or any) script on windows. i was almost giving up when i realised i had written it on notepad and saved on the linux box over samba. use dostounix <scriptfile> to fix the format.
  • RobbyC · 9 months ago
    The reason for this error is that the control character sequence used by DOS (Windows, \r\n) is different from the sequnce used by UNIX (*NIX, \n)
  • TuxSax · 1 month ago
    I had a similar problem until I realized that the file I was working on was created on Windows too.
    I fixed it with:
    sed -i 's/\r$//' <file>
  • JamesDS · 9 months ago
    ah, just what I was looking for - perfect, thanks!
  • mati · 9 months ago
    if you really have to use windows, then cygwin is your salvation.
  • Olly · 9 months ago
    Thank you very much for this snipped - just what I was looking for!
  • kool · 6 months ago
    thnx a lot pal
    I owe u 5 marks of my final exam
    :)