I am writing a script that needs to read a file containing information of a package for which I wrote this line
apt show $PACKAGE_NAME > pack_info.txt
However this doesn't creates the pack_info.txt
file and always gives this Warning :
WARNING : apt does not have a stable CLI interface. Use with caution in scripts.
For the time being I tried redirecting both STDOUT
& STDERR
using &>
and it worked out to give a file pack_info.txt
that we need.
I also tried getting contents from dpkg
and that also worked :
dpkg -s $PACKAGE_NAME > pack_info.txt
What is good that it neither shows a warning nor an error.
What is bad that we don't want to use dpkg and only want STDOUT of apt to redirect to file.
So, I have three Questions to ask :
- What do we exactly mean by Stable CLI Interface ?
- How to safely and error-free use such commands in scripts ? [please care to explain with example]
- Is there a way to only and only redirect STDOUT of
apt show
to a file ?