1

Clearcase command line mkattr needs to wrap variable $bug_num between single quote + quote + $varible + quote + single quote, like this:

cleartool mkattr -replace BUGNUM '"$bug_num"' clearcase_file

How to make a call of the command cleartool mkattr in a Perl script in Unix env? Env is Unix AIX and ksh

pindare
  • 2,382
  • 6
  • 21
  • 24

1 Answers1

4

As mentioned in this recent answer:

If you want to execute a system command and don't have to use any shell syntax like redirects, it's usually better and safer to use the list form of system:

system(
    'cleartool',  'mkattr', '-replace', 'BUGNUM ',
    qq{"$bug_num"}, qq{clearcase_file}
);
# or, if you really want to pass both types of quotes:
system(
    'cleartool',  'mkattr', '-replace', 'BUGNUM ',
    qq{'"$bug_num"'}, qq{clearcase_file}
);

Or:

system(qq{cleartool mkattr -replace BUGNUM '"$bug_num"' clearcase_file});
VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250