Problem in making a script

Colin Law clanlaw at googlemail.com
Wed Jun 29 20:08:28 UTC 2011


On 29 June 2011 14:33, amritpal pathak <amritpalpathak1 at gmail.com> wrote:
>
>
>
> I tried syntax given by you as:
>  TEMP=$(mktemp)
> head -n $(($4 - 1)) "$abc.tex" > "$TEMP"
> echo "$fname" >> "$TEMP"
> LEN=$(cat "$abc.tex"|wc -l)
> tail -n $(($LEN - $4)) "$abc" >> "$TEMP"
> mv "$TEMP" "$abc.tex"
>                  Here abc.tex file is a file which i want to edit at line
> number 4.
> name is accepted from user.but when i ran it as "sh filename.sh",it gave
> following error.
> head: cannot open `.tex' for reading: No such file or directory
> cat: .tex: No such file or directory
> a.sh: 27: arithmetic expression: expecting primary: "0 - "
>
>                      I am sure i am wrong somewhere.Please help sir

I know that you use Ruby as you also post in the Ruby on Rails list,
so you could write a Ruby script to do it rather than having to
struggle with a new language.

Colin




More information about the ubuntu-users mailing list