Skip to content

Commit d6d28db

Browse files
committed
Update Command_Line.sh
1 parent 8d8cc14 commit d6d28db

File tree

6 files changed

+51
-24
lines changed

6 files changed

+51
-24
lines changed

System_ver3/Command_Line.sh

+29-3
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,6 @@ do
161161
comment=""
162162
fi
163163

164-
165-
166164
#入力待機
167165
if [ "$cmd_mode" = "__getch" ]; then
168166
read -ep `echo -e "${C_c}$((line_sup+1))${Cend} ${C_c}>${Cend}"` _cmd
@@ -193,6 +191,7 @@ do
193191
;;
194192
:)
195193
cmd_mode="getch__"
194+
sn=0
196195
;;
197196
*)
198197
eval "${_cmd}" || read -s -n 1
@@ -216,12 +215,39 @@ do
216215
:)
217216
cmd_mode="__getch"
218217
;;
218+
"")
219+
if [ "$comment" != "" ]; then
220+
echo " ${C_c}>${Cend}${comment}" >> $PATH_cmd_hist
221+
tf_ex="true"
222+
case "$comment" in
223+
*vim*|*less*)
224+
tf_ex="true"
225+
;;
226+
*cat*)
227+
if [ `echo "${comment}" | awk '{print NF}'` -eq 2 ]; then read -s -n 1
228+
tf_ex="false"
229+
else
230+
tf="true"
231+
fi
232+
;;&
233+
*)
234+
result=`eval "${comment}" 2> /dev/null`
235+
if [ "${result}" != "" -a $tf_ex = "true" ]; then
236+
echo "`eval "${comment}" 2> /dev/null`" >> $PATH_cmd_hist
237+
fi
238+
;;
239+
esac
240+
cmd_mode="__getch"
241+
fi
242+
;;
243+
*)
244+
;;
219245
esac
220246
fi
221247

222248
#書き込み
223249
if [ "$cmd_mode" = "__getch" ]; then
224-
if [ "$_cmd" != "[" -a "$_cmd" != "]" ]; then
250+
if [ "$_cmd" != "[" -a "$_cmd" != "]" -a "$_key" != ":" -a "$comment" = "" ]; then
225251
echo " ${C_c}>${Cend}${_cmd}" >> $PATH_cmd_hist
226252
fi
227253
if [ "$_cmd" != "" ]; then

System_ver3/TMP_folder/cmd_hist.txt

+5-4
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
Hello
33
\e[32m>\e[mecho "OK"
44
OK
5-
\e[32m>\e[mcat test.c
6-
\e[32m>\e[mcd work
7-
\e[32m>\e[mcat test_file
8-
\e[32m>\e[mecho `cat test_file`
5+
\e[32m>\e[mecho "Yes"
6+
Yes
7+
\e[32m>\e[mls
8+
Git How_to data_folder my_folder test.c test.cc test.sh work
9+
\e[32m>\e[mecho "Hello"
910
Hello
+7-7
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
TT_dir1
2-
TT_dir2
3-
progress.txt
1+
Git
2+
How_to
3+
data_folder
4+
my_folder
5+
test.c
6+
test.cc
47
test.sh
5-
test_dir1
6-
test_dir1_cp
7-
test_dir2
8-
test_file
8+
work

System_ver3/TMP_folder/mode.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
display
1+
Command_Line

System_ver3/TMP_folder/pwd.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
/home/nabla27_2/work
1+
/home/nabla27_2

System_ver3/TMP_folder/show_file.txt

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
 > 1 TT_dir1/
2-
2 TT_dir2/
3-
3 progress.txt
4-
4 test.sh
5-
5 test_dir1/
6-
6 test_dir1_cp/
7-
7 test_dir2/
8-
8 test_file
1+
 > 1 Git/
2+
2 How_to/
3+
3 data_folder/
4+
4 my_folder/
5+
5 test.c
6+
6 test.cc
7+
7 test.sh
8+
8 work/

0 commit comments

Comments
 (0)