tinkering with trap and exit commands

$echo $?
0
$echo $?
0
$exit 10 | tee solve.txt
$cat solve.txt 
$rm solve.txt 
$exit 10 | echo $?
0
$exit -1 | echo $?
0
$exit -1 | echo $?
0
$false | true
$echo $?
0
$false
$echo $?
1
$true
$echo $?
0
$exit 5 | tee var=$?
$file var\=0 
var=0: empty
$type var
bash: type: var: not found
$file var\=0 
var=0: empty
$

$trap $? > solve.txt exit 10
$cat solve.txt 
Display all 296 possibilities? (y or n)
$cat solve.txt 
$trap echo $? > solve.txt exit 10
$cat solve.txt 
$trap `echo $? > solve.txt` exit 10
$cat solve.txt 
0
$

$bash -c 'exit 7'; echo $?
7
$bash -c `exit 7`; echo $?
bash: -c: option requires an argument
2
$bash -c 'exit 7'; echo $?
7
$trap 'echo $? > solve.txt' exit 10
$cat solve.txt 
0
$cat solve.txt 
0
$bash -c 'exit 11'; echo $?
11
$


Indicate how each name would be interpreted if used as a command name

$type -a locate
locate is /usr/bin/locate
$type -a ls
ls is aliased to `ls --color=auto'
ls is /bin/ls
$type -t ls
alias
$type -t locate
file
$type -t /dev/urandom
$type -t /dev/sda1
$type -t urandom
$type -t sda1
$type -t type
builtin
$type -t shuf
file
$type -t bash
file
$type -t proc
$type -t debugfs
$sudo type -t debugfs
[sudo] password for jeffrin: 
sudo: type: command not found
$sudo type -t debugfs
sudo: type: command not found
$

fold: Wrap input lines to fit in specified width

$cat test.pl
use strict;
use File::Rename ();
use Pod::Usage;

main() unless caller;

sub main {
    my $options = File::Rename::Options::GetOptions
        or pod2usage;

    mod_version() if $options->{show_version};
    pod2usage( -verbose => 2 ) if $options->{show_manual};
    pod2usage( -exitval => 1 ) if $options->{show_help};

    @ARGV = map {glob} @ARGV if $^O =~ m{Win}msx;

    File::Rename::rename(\@ARGV, $options);
}

sub mod_version {
    print __FILE__ .
	' using File::Rename version '.
        $File::Rename::VERSION ."\n\n";
    exit 0
}   

1;

__END__

$
$fold  -w 10 -b  test.pl > part1.txt
$fold  -w 10   test.pl > part2.txt
$diff -u part1.txt part2.txt 
--- part1.txt	2018-03-15 22:50:38.084905051 +0530
+++ part2.txt	2018-03-15 22:50:48.768963638 +0530
@@ -55,10 +55,10 @@
 rsion {
     print 
 __FILE__ .
-	' using F
-ile::Renam
-e version 
-'.
+	' 
+using File
+::Rename v
+ersion '.
         $F
 ile::Renam
 e::VERSION

command to install build-essential in debian ?

$sudo apt-get install build-essential 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
build-essential is already the newest version (12.4).
The following packages were automatically installed and are no longer required:
  alsa-base ant ant-optional app-install-data aptdaemon aptdaemon-data bluez-alsa bluez-gstreamer bogofilter bogofilter-bdb bogofilter-common cryptsetup-bin diffstat
  esound-common espeak-data evolution-webcal firebird2.5-common-doc fonts-lyx fonts-sil-gentium fonts-sil-gentium-basic freerdp-x11 gcalctool gcc-6-base gdebi
  gdebi-core geoclue geoclue-hostip geoclue-localnet geoclue-manual geoclue-nominatim geoclue-yahoo gir1.2-camel-1.2 gir1.2-clutter-gst-1.0 gir1.2-ebookcontacts-1.2
  gir1.2-edataserver-1.2 gir1.2-folks-0.6 gir1.2-gconf-2.0 gir1.2-gee-0.8 gir1.2-gee-1.0 gir1.2-gkbd-3.0 gir1.2-grilo-0.2 gir1.2-gst-plugins-base-0.10
  gir1.2-gstreamer-0.10 gir1.2-gtop-2.0 gir1.2-javascriptcoregtk-3.0 gir1.2-networkmanager-1.0 gir1.2-nmgtk-1.0 gir1.2-panelapplet-5.0 gir1.2-tracker-0.14
  gir1.2-tracker-1.0 gir1.2-vte-2.90 gir1.2-webkit-3.0 gir1.2-xkl-1.0 glchess glines gnash-common gnect gnibbles gnobots2 gnome-games-data gnome-games-extra-data
  gnome-icon-theme-extras gnome-icon-theme-symbolic gnome-js-common gnome-mag gnome-media gnomine gnotravex gnotski gnuplot-tex gnuplot5-data gnuplot5-qt
  gstreamer0.10-ffmpeg gstreamer0.10-gconf gstreamer0.10-nice gstreamer0.10-plugins-bad gstreamer0.10-plugins-base gstreamer0.10-plugins-good
  gstreamer0.10-plugins-ugly gstreamer0.10-pulseaudio gstreamer0.10-x gtali hexchat-python hplip-data hyphen-en-us icedtea-netx icedtea-netx-common imagemagick-common
  iptraf iptraf-ng libamd2.2.0 libamd2.3.1 libamd2.4.1 libapache-pom-java libappstream3 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libapt-pkg-perl
  libasprintf0c2 libass4 libass5 libatk-adaptor-data libatspi1.0-0 libaudiofile1 libavcodec-ffmpeg56 libavcodec53 libavcodec56 libavdevice-ffmpeg56 libavfilter-ffmpeg5
  libavformat-ffmpeg56 libavformat53 libavformat56 libavresample-ffmpeg2 libavresample2 libavutil-ffmpeg54 libavutil51 libavutil54 libbasicusageenvironment1
  libbind9-80 libbind9-90 libblas-common libblas3gf libbluray1 libboost-filesystem1.58.0 libboost-iostreams1.58.0 libboost-program-options1.49.0
  libboost-program-options1.58.0 libboost-program-options1.62.0 libboost-system1.58.0 libboost-thread1.49.0 libbrlapi0.5 libcamd2.3.1 libcamd2.4.1 libcamel-1.2-33
  libcamel-1.2-54 libcamel-1.2-59 libccolamd2.8.0 libccolamd2.9.1 libcdaudio1 libcddb2 libcdio-cdda1 libcdio-paranoia1 libcdio13 libcholmod2.1.2 libcholmod3.0.6
  libchromaprint0 libclutter-gst-1.0-0 libclutter-gst-2.0-0 libclutter-imcontext-0.1-0 libclutter-imcontext-0.1-bin libcluttergesture-0.0.2-0 libcmis-0.2-0
  libcolamd2.7.1 libcolamd2.8.0 libcolamd2.9.1 libcolorblind0 libcolord1 libcommons-beanutils-java libcommons-collections3-java libcommons-compress-java
  libcommons-digester-java libcommons-logging-java libcommons-parent-java libcpufreq0 libcryptsetup4 libcurl3 libdb-java libdb-je-java libdb5.1-java-jni libdb5.3-java
  libdb5.3-java-jni libdbus-1-dev libdconf0 libdevmapper-event1.02.1 libdirac-encoder0 libdirectfb-1.2-9 libdns-export100 libdns100 libdns88 libdotconf1.0
  libdrm-nouveau1a libdvbpsi10 libebackend-1.2-2 libebml4v5 libebook-1.2-16 libecal-1.2-11 libedata-cal-1.2-15 libedataserver-1.2-16 libedataserver-1.2-21 libefivar0
  libepc-1.0-3 libepc-common libepc-ui-1.0-3 libesd0 libespeak1 libevent-2.0-5 libexiv2-12 libfarstream-0.1-0 libffi5 libfftw3-3 libfftw3-long3 libfreerdp-cache1.1
  libfreerdp-client1.1 libfreerdp-codec1.1 libfreerdp-common1.1.0 libfreerdp-core1.1 libfreerdp-crypto1.1 libfreerdp-gdi1.1 libfreerdp-locale1.1
  libfreerdp-plugins-standard libfreerdp-primitives1.1 libfreerdp-rail1.1 libfreerdp-utils1.1 libfwupd1 libgconf2-4 libgd2-xpm libgdata13 libgdiplus libgdu-gtk0
  libgdu0 libgee2 libgeoclue0 libgexiv2-1 libgfortran3 libgif4 libgit2-23 libglew1.7 libgmime-2.6-0 libgnome-bluetooth10 libgnome-mag2 libgnome-media-profiles-3.0-0
  libgnomekbd7 libgnutls-openssl27 libgom-1.0-common libgphoto2-2 libgphoto2-port0 libgrilo-0.1-0 libgrilo-0.2-1 libgroupsock8 libgssglue1
  libgstreamer-plugins-bad0.10-0 libgstreamer-plugins-base0.10-0 libgstreamer0.10-0 libgtkglext1 libgtkhtml-4.0-0 libgtkhtml-4.0-common libgtkhtml-editor-4.0-0
  libgtop-2.0-10 libgtop2-7 libguess1 libgupnp-dlna-1.0-2 libgweather-3-0 libhsqldb-java libhttp-parser2.1 libhunspell-1.3-0 libhunspell-1.4-0 libical0 libical1a
  libicc2 libicu48 libicu4j-4.2-java libicu4j-java libilmbase12 libilmbase6v5 libimdi0 libimobiledevice2 libimobiledevice4 libisc-export95 libisc84 libisc95 libisccc80
  libisccc90 libisccfg82 libisccfg90 libiso9660-8 libjasper1 libjavascriptcoregtk-1.0-0 libjavascriptcoregtk-3.0-0 libjaxp1.3-java libjemalloc1 libjim0.76
  libjim0debian2 libjline-java libjpeg8 libjs-jquery libjson-c2 libjson0 libjtidy-java liblcms1 liblensfun-data liblensfun0 liblimba0 liblinear1 liblircclient0
  liblivemedia52 liblognorm2 liblouis2 liblouis9 liblouisutdml6 liblua5.1-0 liblucene2-java liblvm2app2.2 liblwres80 liblwres90 libm17n-0 libmagick++5 libmagickcore5
  libmagickwand5 libmatroska6v5 libmimic0 libminiupnpc10 libminiupnpc5 libmono-cairo4.0-cil libmono-system-drawing4.0-cil libmozjs-24-0 libmozjs10d libmozjs185-1.0
  libmpc2 libmpfr4 libmusicbrainz5-0 libmx-bin libmx-common libnm-glib-vpn1 libnm-glib4 libnm-gtk-common libnm-gtk0 libnm-util2 libopencv-calib3d2.4v5
  libopencv-contrib2.4v5 libopencv-core2.4v5 libopencv-features2d2.4v5 libopencv-flann2.4v5 libopencv-highgui2.4-deb0 libopencv-imgproc2.4v5 libopencv-legacy2.4v5
  libopencv-ml2.4v5 libopencv-objdetect2.4v5 libopencv-video2.4v5 libopenexr6v5 libopenjpeg2 libopenobex2 libopenraw1 liborcus-0.10-0v5 libotf0 libpanel-applet0
  libparted0debian1 libpcre16-3 libpgm-5.1-0 libplist1 libpoppler19 libpoppler57 libpoppler72 libpostproc-ffmpeg53 libpostproc52 libprocps5 libproj12
  libprotobuf-lite9v5 libproxy-tools libproxy0 libpsl0 libpst4 libpth20 libpython3.5-minimal libpython3.5-stdlib libqgsttools-p1 libqmi-glib1 libqpdf17 libqpdf18
  libqt5multimedia5-plugins libqt5multimediawidgets5 libqt5opengl5 libquvi-scripts libquvi7 librarian0 libraw15 libraw5 libre2-3 libreadline5 libregexp-java
  libreoffice libreoffice-emailmerge libreoffice-help-en-us libreoffice-report-builder-bin libresid-builder0c2a librest-extras-0.7-0 librhythmbox-core9 librtmp0
  libschroedinger-1.0-0 libsctp1 libseed-gtk3-0 libservlet2.5-java libsidplay2 libslp1 libslv2-9 libsndio6.0 libsnmp-base libsocialweb-client2 libsocialweb-common
  libsocialweb-service libsocialweb0 libsodium13 libsoundtouch0 libspice-client-gtk-3.0-4 libsuitesparseconfig4.4.5 libswresample-ffmpeg1 libswscale-ffmpeg3
  libswscale2 libsystemd-daemon0 libsystemd-login0 libt1-5 libtelepathy-farstream2 libtelepathy-logger2 libtidy-0.99-0 libtiff4 libtracker-control-1.0-0
  libtracker-extract-0.14-0 libtracker-miner-0.14-0 libtracker-miner-1.0-0 libtracker-sparql-0.14-0 libtracker-sparql-1.0-0 libtrio2 libts-0.0-0 libtxc-dxtn-s2tc0
  libumfpack5.4.0 libumfpack5.6.2 libumfpack5.7.1 libunique-3.0-0 libunistring0 libupnp6 libupower-glib1 libusageenvironment3 libusbmuxd1 libusbmuxd2 libuuid-perl
  libva-drm1 libva-glx1 libva-wayland1 libva-x11-1 libva1 libvisio-0.0-0 libvlc-bin libvlc5 libvlccore8 libvlccore9 libvpx1 libvpx3 libvpx4 libvte-2.90-9
  libvte-2.90-common libwebkitgtk-1.0-0 libwebkitgtk-3.0-0 libwebpdemux1 libwebpmux1 libwebpmux2 libwebrtc-audio-processing-0 libwildmidi1 libwinpr-crt0.1
  libwinpr-crypto0.1 libwinpr-dsparse0.1 libwinpr-environment0.1 libwinpr-file0.1 libwinpr-handle0.1 libwinpr-heap0.1 libwinpr-input0.1 libwinpr-interlocked0.1
  libwinpr-library0.1 libwinpr-path0.1 libwinpr-pool0.1 libwinpr-registry0.1 libwinpr-rpc0.1 libwinpr-sspi0.1 libwinpr-synch0.1 libwinpr-sysinfo0.1 libwinpr-thread0.1
  libwinpr-utils0.1 libwireshark6 libwiretap5 libwpd-0.9-9 libwpg-0.2-2 libwps-0.2-2 libwsutil6 libx264-123 libx264-142 libx264-148 libx265-68 libx265-79 libx265-95
  libxalan2-java libxapian22v5 libxerces2-java libxfreerdp-client1.1 libxml-commons-external-java libxml-commons-resolver1.1-java libxtables10 libxz-java libzmq3
  linux-headers-4.3.0-1-amd64 linux-headers-4.3.0-1-common linux-image-3.2.0-4-amd64 linux-image-4.3.0-1-amd64 linux-kbuild-4.3 m17n-contrib m17n-db mahjongg
  mythes-en-us obex-data-server openssh-blacklist openssh-blacklist-extra pcmciautils pkg-config python-aptdaemon python-aptdaemon.gtk3widgets python-beautifulsoup
  python-brlapi python-dbus-dev python-defer python-defusedxml python-feedparser python-fpconst python-gnupginterface python-imaging python-libxml2 python-louis
  python-mako python-markupsafe python-ndg-httpsclient python-packagekit python-pexpect python-ptyprocess python-pyasn1 python-pyatspi python-soappy
  python-software-properties python-utidylib python-wstools python-zeitgeist python3-aptdaemon python3-aptdaemon.gtk3widgets python3-defer python3.5 python3.5-minimal
  rdesktop rsync shotwell shotwell-common system-config-printer t1utils tcpd tex-common tsconf ttf-liberation ttf-sil-gentium-basic udisks vlc-data xchat-gnome-common
  xfonts-mathml
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 248 not upgraded.
$