#!/bin/sh
# Script to count the total in an array
# Define the name of the file
#
fname=names.txt
# Read in the contact details from the keyboard
echo "Please enter the following contact details:"
echo
echo "Given name: \c"
read name
echo " value: \c"
read value
# Write the details to the text file
echo $name:$value >> $fname
我試圖代碼在bash腳本什麼的,我有一個txt文件,我進入了它的名稱如下如陣列在bash shell腳本
lex +7.5
creg +5.3
xondr/xonde +1.5
gloria-1
lex +7.5
gloria -1
creg +5.3
xondr/xonde +1.5
lex +7.5
#and so on
我希望有一個代碼或環當我運行該程序時,它應該顯示在txt文件上的名稱,並顯示總數,如果lex出現7次,凱萊3次,它會顯示lex 52.5 gloria-3等。我不知道你是否得到我的想法...
好吧,你的shebang表示'sh',而不是'bash' – c00kiemon5ter
它是否真的必須是shell腳本?我不是在拖釣,只是問。 –
你的問題是什麼? –