Why wouldn't "stringing" of an input parameter using an array work? ...
Why would:
kate "file1_ps_-aux.txt" "file2_dmesg.txt" "file3_printenv.txt" &
kate "${_FL1}" "${_FL2}" "${_FL3}" &
work?, but stringing the file names using a loop wouldn't?
I need to keep somehow declaratively the files read in by kate at
start up, so I thought of using an array:
#
_FL1="file1_ps_-aux.txt"; sudo ps -aux > "${_FL1}"
_FL2="file2_dmesg.txt"; sudo dmesg > "${_FL2}"
_FL3="file3_printenv.txt"; sudo printenv > "${_FL3}"
ls -l "file"*".txt"; wc -l "file"*".txt"
_KSX_AR=(
"${_FL1}"
"${_FL2}"
"${_FL3}"
)
_KSX_AR_L=${#_KSX_AR[@]}
echo "// __ \$_KSX_AR_L: |$_KSX_AR_L|"
# kate session files to be opened
_KSX=""
if [[ ${_KSX_AR_L} > 0 ]]; then
if [[ -f "${_KSX_AR[0]}" ]]; then
_KSX="\"${_KSX_AR[0]}\""
if [[ ${_KSX_AR_L} > 1 ]]; then
for(( _IX=1; _IX<${_KSX_AR_L}; ++_IX )); do
if [[ -f "${_KSX_AR[_IX]}" ]]; then
_KSX="${_KSX} \"${_KSX_AR[$_IX]}\""
echo "// __ [$_IX/$_KSX_AR_L): |${_KSX}|"
fi
done
fi
fi
fi
#
echo "// __ \${_KSX}: |${_KSX}|"
# this doesn't seem to work
kate "${_KSX}" &
lbrtchx
Reply to: