Pergunta

When using ar with an archive name that already exists, this message is generated:

+ ar rcs /tmp/libcpfs.a.3nbsv /tmp/cpfs.c.ERGsn /tmp/log.c.1lk6G
ar: /tmp/libcpfs.a.3nbsv: File format not recognized

The existing archive name is either an empty file (created by mktemp).

I want to clobber whatever contents are there anyway, the contents of any existing file (be it an ar or not) don't interest me. How can I enforce this?

Update0

I'm currently using rm "$libcpfs_a" && ar rcs "${libcpfs_a}" ${libcpfs_objs[*]} as a workaround.

Foi útil?

Solução

Try forcibly removing the file before calling ar.

rm -f $file
ar rcs $file foo.c bar.c
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top