Category: Programming Languages

  • A bash builtin command named “enable” to enable or disable a bash builtin command

    [bash light=”true”] $command $echo $? 0 $enable -n command $command bash: command: command not found $echo $? 127 $enable command $command $enable -n enable $enable bash: enable: command not found $ [/bash] RELATED SOURCE CODE EXPOSURE [c light=”true”] /* Enable/disable shell commands present in LIST. If list is not specified, then print out a list […]

  • Command for PHP information and configuration

    [php] $php –info phpinfo() PHP Version => 7.3.0RC3 System => Linux debian 4.17.0-3-amd64 #1 SMP Debian 4.17.17-1 (2018-08-18) x86_64 Build Date => Oct 15 2018 09:53:04 Server API => Command Line Interface Virtual Directory Support => disabled Configuration File (php.ini) Path => /etc/php/7.3/cli Loaded Configuration File => /etc/php/7.3/cli/php.ini Scan this dir for additional .ini files […]

  • finding source code or source file of a typical bash function

    $type -a signals bash: type: signals: not found $type -a _signals _signals is a function _signals () { local -a sigs=($( compgen -P “$1” -A signal “SIG${cur#$1}” )); COMPREPLY+=(“${sigs[@]/#${1}SIG/${1}}”) } $declare -F _signals _signals $shopt -s extdebug $declare -F _signals _signals 862 /usr/share/bash-completion/bash_completion $declare -F _command _command 1732 /usr/share/bash-completion/bash_completion $declare -F compgen $declare -F _grub_dirs […]

  • caller — returns the context of any active subroutine call

    $cat test.bash!/bin/bash die() { local frame=0 while caller $frame; do ((frame++)); done echo “$*” exit 1 } f1() { die “*** an error occured ***”; } f2() { f1; } f3() { f2; } f3 $ $bash test.bash 12 f1 test.bash 13 f2 test.bash 14 f3 test.bash 16 main test.bash *** an error occured *** […]

  • Typical Bash Shell bind Command Examples

    https://linux.101hacks.com/unix/bind/

  • sort – sort lines of text files

    $cat test.txt sept aug jan dec oct apr feb mar11 mar1 $sort test.txt apr aug dec feb jan mar1 mar11 oct sept $sort -M test.txt jan feb mar1 mar11 apr aug sept oct dec $

  • What is Tracker?

    https://wiki.gnome.org/Projects/Tracker/WhatIsTracker

  • 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__ […]

  • Calling an external command in Python

    $pwd /home/jeffrin/beautifulwork/github $ls beautifulwork-github.php beautifulwork-github.py $ls -l total 8 -rw-r–r– 1 jeffrin jeffrin 414 Dec 10 2016 beautifulwork-github.php -rw-r–r– 1 jeffrin jeffrin 1300 Dec 10 2016 beautifulwork-github.py $cat ../../ls.py from subprocess import call call([“ls”, “-l”]) $python ../../ls.py total 8 -rw-r–r– 1 jeffrin jeffrin 414 Dec 10 2016 beautifulwork-github.php -rw-r–r– 1 jeffrin jeffrin 1300 Dec 10 […]

  • Tuples

    https://www.pythonlearn.com/html-008/cfbook011.html