File:  [Paefchen] / home / as / .csh / reload.csh
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Mon Jan 7 06:03:02 2008 UTC (16 years, 10 months ago) by as
Branches: MAIN
CVS tags: HEAD
Hello My Home ;)

# $Paefchen: home/as/.csh/reload.csh,v 1.1 2008/01/07 06:03:02 as Exp $

# CSHRC_RELOAD: NO
# CSHRC_ROMPTONLY: YES

if ("`alias reload`" == "") then
	aliass reload ~/.csh/reload.csh
else 
	if ($# < 1) then
		
		if ($?tcsh) then			
			set _shells = 'CSH TCSH'
			printf " %-12s %-6s %-s\n" NAME SHELL BESCHREIBUNG
		else
			set _shells = 'CSH'
			printf " %-12s %-s\n" NAME BESCHREIBUNG
		endif
		
		foreach _shell ($_shells)
			foreach _prompt (_ _PROMPT_)
				set _list = `eval echo '$'"AS_CSHRC_${_shell}${_prompt}FILES"`
				foreach _script ($_list)
					set _script = "${HOME}/.csh/$_script.$_shell:al"
					if (! -f $_script) continue
					set _yes = `\
						awk -F '[:]*' '/# *AS_CSHRC_RELAOD:/ {print $2}' < "$_script" |\
						sed 's/ //g'`
					if ($_yes:al != 'yes') continue
					set _descr = `awk -F '[:]*' '/# *AS_CSHRC_RELAOD_DESCR:/ {print $2}' < "$_script"`
					if ($?tcsh) then
						printf "%-12s %-6s %-s\n" $_script:t:r $_shell:al "$_descr"
					else
						printf "%-12s %-s\n" $_script:t:r "$_descr"
					endif
				end
			end
		end
		unset _shells _shell _prompt _list _script _yes _descr

	else if ($1 == '--help') then
		echo "Hilfe: reload [<skript>[.<shell>]]"

	else 
		set _script = "${HOME}/.csh/"`echo $1 | awk -F '[.]*' '{print $1}'`
		set _shell = `echo $1 | awk -F '[.]*' '{print $2}'`
		if ($_shell == "") then
			if (-f $_script.csh) then
				set _script = $_script.csh
			else if (-f $_script.tcsh) then
				set _script = $_script.tcsh
			else 
				echo "Fehler: $1 konnte keine zugehoerige Shell finden."
				set _error
			endif
		else	
			set _script = $_script.$_shell
			if (! -f $_script) then
				echo "Fehler: $_script:t konnte nicht gefunden werden."
				set _error
			endif
		endif

		if (! $?_error) then
			source $_script
		endif
		
		unset _script _shell _error

	endif
endif