bash dirs कमांड और + N विकल्प


1

मैं + N विकल्प के साथ dirs कमांड का उपयोग करने की कोशिश कर रहा हूं। मैनुअल कहता है:

 dirs [-clpv] [+n] [-n]
          Without options, displays the list of currently remembered directories.  The default display is on a single line with directory names separated by spaces.   Direc-
          tories are added to the list with the pushd command; the popd command removes entries from the list.
          +n     Displays the nth entry counting from the left of the list shown by dirs when invoked without options, starting with zero.

dirs -v शो:
0 /dir1/
1 /dir2/
2 /dir3/

हालाँकि, dir + n 1, dir + N 1, dir -v + n 1, dir -v + N 1 सभी देखें:

bash: dirs: +n: invalid number
dirs: usage: dirs [-clpv] [+N] [-N]

क्या किसी को पता है कि मैं क्या गलत कर रहा हूँ?

धन्यवाद

टारस

जवाबों:


3

कमांड का dirs +Nमतलब है कि आपको वास्तव में वहां एक नंबर डालना है:

$ dirs -v
 0  /usr/local
 1  /usr
 2  /etc/init.d
 3  /etc
 4  /
 5  ~

$ dirs +3
/etc

3

यदि आप बारीकी से देखते हैं, तो आप देखेंगे कि nयह रेखांकित है, जिसका अर्थ है कि यह एक चर है, न कि एक स्ट्रिंग जिसे आप शब्दशः टाइप करते हैं।

इस स्थिति में, nकिसी भी संख्या के लिए खड़ा है

जैसे dirs +1या pushd +1


दोनों सही - शायद इनाउन्ट होना चाहिए कि: *)
ट्रेंट
हमारी साइट का प्रयोग करके, आप स्वीकार करते हैं कि आपने हमारी Cookie Policy और निजता नीति को पढ़ और समझा लिया है।
Licensed under cc by-sa 3.0 with attribution required.