From: Chris Koeritz Date: Thu, 9 Apr 2015 01:08:43 +0000 (-0400) Subject: tasty changes to the inventory command, which now has that name instead of just 'i'. X-Git-Tag: 2.140.90~670 X-Git-Url: https://feistymeow.org/gitweb/?a=commitdiff_plain;h=4d7f9a2b66436582743d72baf3071825b910dd23;p=feisty_meow.git tasty changes to the inventory command, which now has that name instead of just 'i'. also some nice changes to various ls type aliases, now using the summing dir, and the summing dir has been fixed to actually use ls colors properly. this is a fairly nice little set of changes... --- diff --git a/scripts/core/common.alias b/scripts/core/common.alias index 5d2e6782..995916fc 100644 --- a/scripts/core/common.alias +++ b/scripts/core/common.alias @@ -41,8 +41,11 @@ else fi # re-use work we did on 'exp' macro for the longer windows command. alias explorer=exp -alias l='\ls -hFC $color_add' -alias ls='\ls -hFC $color_add' +alias i=inventory +alias l='perl $FEISTY_MEOW_SCRIPTS/files/summing_dir.pl' +alias ll='\ls -hFC $color_add' +alias ls='perl $FEISTY_MEOW_SCRIPTS/files/summing_dir.pl' +#='\ls -hFC $color_add' alias lsd='ls -hl' alias md='mkdir' alias more='less' diff --git a/scripts/core/functions.sh b/scripts/core/functions.sh index a111348c..a7c0b627 100644 --- a/scripts/core/functions.sh +++ b/scripts/core/functions.sh @@ -8,7 +8,7 @@ function_sentinel &>/dev/null if [ $? -eq 0 ]; then # there was no error, so we can skip the inits. if [ ! -z "$SHELL_DEBUG" ]; then - echo skipping functions.sh because already defined. + echo "skipping function definitions, because already defined." fi skip_all=yes fi @@ -16,7 +16,7 @@ fi if [ -z "$skip_all" ]; then if [ ! -z "$SHELL_DEBUG" ]; then - echo function definitions begin... + echo "feisty meow function definitions beginning now..." fi # a handy little method that can be used for date strings. it was getting @@ -289,7 +289,7 @@ if [ -z "$skip_all" ]; then # interesting note perhaps: found that the NETHACKOPTIONS variable was # not being unset correctly when preceded by an alias. split them up # like they are now due to that bug. - unset -v FEISTY_MEOW_GENERATED NECHUNG NETHACKOPTIONS + unset -v CORE_ALIASES_LOADED FEISTY_MEOW_GENERATED NECHUNG NETHACKOPTIONS unset -f function_sentinel # reload feisty meow environment in current shell. source $FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh @@ -384,7 +384,7 @@ if [ -z "$skip_all" ]; then function function_sentinel() { return 0; } - if [ ! -z "$SHELL_DEBUG" ]; then echo function definitions end....; fi + if [ ! -z "$SHELL_DEBUG" ]; then echo "feisty meow function definitions done."; fi fi diff --git a/scripts/core/generate_aliases.pl b/scripts/core/generate_aliases.pl index 8408b583..40f555e9 100644 --- a/scripts/core/generate_aliases.pl +++ b/scripts/core/generate_aliases.pl @@ -127,9 +127,9 @@ sub rebuild_script_aliases { print GENOUT "##\n"; if (length($test_color)) { - print GENOUT "color_add=--color=auto\n"; + print GENOUT "export color_add=--color=auto\n"; } else { - print GENOUT "color_add=\n"; + print GENOUT "export color_add=\n"; } # plow in the full set of aliases into the file. diff --git a/scripts/core/i.sh b/scripts/core/i.sh deleted file mode 100644 index fd2fd735..00000000 --- a/scripts/core/i.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -source "$FEISTY_MEOW_SCRIPTS/core/functions.sh" - -echo '==============' -echo -echo Your user name is $USER on a computer named $(hostname). -echo Your machine platform is $(uname -m) -echo -n Uptime: -uptime -if [ $OPERATING_SYSTEM == "UNIX" ]; then - which lsb_release &>/dev/null - if [ $? -eq 0 ]; then - lsb_release -a - fi -fi -echo The time is $(date_stringer | sed -e 's/_/ /g' | sed -e 's/\([0-9][0-9]\) \([0-9][0-9]\)$/:\1:\2/') -echo -echo '==============' -echo -echo You have the following files here: -ls -FC -echo -echo '==============' -echo -echo You are sharing the machine with: -who -echo -echo '==============' - diff --git a/scripts/core/inventory.sh b/scripts/core/inventory.sh new file mode 100644 index 00000000..744fb0ae --- /dev/null +++ b/scripts/core/inventory.sh @@ -0,0 +1,41 @@ +#!/bin/bash + +# a frivolous but useful script that shows information about the local +# computer in terms of an adventure game inventory listing. + +source "$FEISTY_MEOW_SCRIPTS/core/functions.sh" + +echo +echo '++++++++++++++++++++++++++++++++++++++++++' + +unset codename +if [ $OPERATING_SYSTEM == "UNIX" ]; then + which lsb_release &>/dev/null + if [ $? -eq 0 ]; then + codename="$(lsb_release -cs 2>/dev/null)" + fi +fi +if [ -z "$codename" ]; then + codename="mysterioso" +fi + +echo +echo "it is $(date +"%A at %H%M hours on day%e of the %B moon in the gregorian year %Y" | tr A-Z a-z) and our intrepid adventurer $USER is exploring a computer named $(hostname) (code-name $codename) and has found that the machine's OS platform is $(uname -m) and its current incarnation has been $(uptime -p)." | splitter +#hmmm: splitter not accepting these args properly right now: +#--mincol 2 --maxcol 40 +echo +echo '++++++++++++++++++++++++++++++++++++++++++' +echo +echo "the following things appear to be lying around here..." +echo +ls -hFC $color_add +echo +echo '++++++++++++++++++++++++++++++++++++++++++' +echo +echo "there appear to be these entities on this host..." +echo +who -suT +echo +echo '++++++++++++++++++++++++++++++++++++++++++' +echo + diff --git a/scripts/core/launch_feisty_meow.sh b/scripts/core/launch_feisty_meow.sh index b307a24e..5cefe785 100644 --- a/scripts/core/launch_feisty_meow.sh +++ b/scripts/core/launch_feisty_meow.sh @@ -10,15 +10,18 @@ ############## -#export SHELL_DEBUG=true - # this variable causes the scripts that listen to it to print more information - # when they run. +# SHELL_DEBUG: if this variable is non-empty, then it causes the feisty meow +# scripts to print more diagnostic information when they run. not all +# scripts support this, but the core ones do. -export ERROR_OCCURRED= - # no error to start with. +#export SHELL_DEBUG=true ############## +export ERROR_OCCURRED= + # there have been no errors to start with, at least. we will set this + # to non-empty if something bad happens. + if [ -z "$FEISTY_MEOW_GENERATED" ]; then # FEISTY_MEOW_GENERATED is where the generated files are located. # this is our single entry point we can use without knowing any variables @@ -78,14 +81,14 @@ shopt -s checkwinsize ############## if [ -z "$LIGHTWEIGHT_INIT" ]; then - # perform the bulkier parts of the login and initialization. + # perform the bulkier parts of the initialization process. - if [ ! -z "$SHELL_DEBUG" ]; then echo heavyweight login begins...; fi + if [ ! -z "$SHELL_DEBUG" ]; then echo "heavyweight init begins..."; fi # set up the aliases for the shell, but only if they are not already set. if [ -z "$CORE_ALIASES_LOADED" ]; then if [ ! -z "$SHELL_DEBUG" ]; then - echo the aliases were missing, now they are added... + echo "the aliases were missing, now they are being added..." fi source "$FEISTY_MEOW_GENERATED/fmc_core_and_custom_aliases.sh" fi @@ -93,7 +96,7 @@ if [ -z "$LIGHTWEIGHT_INIT" ]; then # allow connections to our x server from the local host. if [ ! -z "$DISPLAY" ]; then if [ ! -z "$(echo "$OS_TYPE" | grep -i darwin)" ]; then - if [ ! -z "$SHELL_DEBUG" ]; then echo Enabling localhost X connections...; fi + if [ ! -z "$SHELL_DEBUG" ]; then echo "Enabling localhost X connections..."; fi xhost + localhost >/dev/null 2>&1 fi fi @@ -101,7 +104,7 @@ if [ -z "$LIGHTWEIGHT_INIT" ]; then # a minor tickle of the title of the terminal, in case there is one. bash $FEISTY_MEOW_SCRIPTS/tty/label_terminal_with_infos.sh - if [ ! -z "$SHELL_DEBUG" ]; then echo heavyweight login ends....; fi + if [ ! -z "$SHELL_DEBUG" ]; then echo "heavyweight init is done."; fi fi if [ -z "$ERROR_OCCURRED" ]; then diff --git a/scripts/core/variables.sh b/scripts/core/variables.sh index befd665c..fa2f774b 100644 --- a/scripts/core/variables.sh +++ b/scripts/core/variables.sh @@ -17,6 +17,9 @@ export PS1='\u@\h $ '; # sets the history length and max file size so we can get some long history around here. export HISTSIZE=1000000 export HISTFILESIZE=8000000 + +# make the TERM available to all sub-shells. +export TERM ############## diff --git a/scripts/files/summing_dir.pl b/scripts/files/summing_dir.pl index d23c5b48..8c060b1c 100644 --- a/scripts/files/summing_dir.pl +++ b/scripts/files/summing_dir.pl @@ -20,7 +20,7 @@ require "filename_helper.pl"; -use Env qw(TMP); +use Env qw($TMP $color_add $TERM); local($chewed_line) = ""; local(@arg_list); @@ -54,13 +54,15 @@ print "[" . $print_list . "]\n\n"; local($temp_file)=`mktemp "$TMP/zz_frdsumdir.XXXXXX"`; chop($temp_file); -system("ls -hlF $chewed_line >$temp_file"); +# drop the main payload, the list of directory info, but also save that +# info to a file for analysis. +system("ls -hlF $color_add $chewed_line"); +system("ls -hlF $color_add $chewed_line > $temp_file"); + # the color_add variable, if defined, will have flags for setting the + # directory listing color scheme. ##print "file is: $temp_file\n"; -# drop the main payload, the list of directory info. -system("cat $temp_file"); - local($lengths) = 0; # open the file and process the lines to get file lengths.