बैश में ये अतिरिक्त आउटपुट लाइनें क्या हैं?


9

यह कुछ समय के लिए है कि इन पंक्तियों को कमांड चलाने के बाद देखा जा सकता है (बेतरतीब ढंग से):

[1]-  Done                    wget -c http://downloads.sourceforge.net/project/zorin-os/9/zorin-os-9-core-32.iso?r=http%3A%2F%2Fzorinos.com%2Fdownload9.html
[2]+  Done                    ts=1460659842

पहली पंक्ति में ही कमांड है और यह हमेशा नहीं हो रहा है। लेकिन समय-समय पर एक कमांड लाइन ऐप बिना कमांड लाइन पर वापस आए रुक जाती है, जब तक कि मैं प्रेस नहीं करता; जो इन पंक्तियों को दर्शाता है।

एक हफ्ते पहले तक मेरा सिस्टम इस तरह का व्यवहार नहीं करता था। क्या ये एक दिक्कत है?

जवाबों:


20

आपने शायद इस तरह एक आदेश जारी किया है:

wget -c http://downloads.sourceforge.net/project/zorin-os/9/zorin-os-9-core-32.iso?r=http%3A%2F%2Fzorinos.com%2Fdownload9.html&ts=1460659842&something-else

उस कमांड में विशेष वर्ण होता है &, जिसका उपयोग कई प्रक्रियाओं को समवर्ती रूप से चलाने के लिए किया जाता है । उस आदेश की व्याख्या तीन (या अधिक) कमांड के रूप में की जा रही है:

# First command (the one that you see after [1]):
wget -c http://downloads.sourceforge.net/project/zorin-os/9/zorin-os-9-core-32.iso?r=http%3A%2F%2Fzorinos.com%2Fdownload9.html
# Second command (the one that you see after [2]):
ts=1460659842
# Third command (the one which output should be above the "Done" lines):
something-else

यहाँ एक उदाहरण है जो आपको बेहतर समझने में मदद कर सकता है:

# Here I'm launching three 'echo' commands, the first two in background, the third in foreground
andrea@andrea-laptop:~$ echo first & echo second & echo third
[1] 5033    # This is bash telling me that the first process was started with job number 1 and PID 5033
first       # This is the output from the first process
[2] 5034    # This is bash telling me that the second process was started with job number 2 and PID 5034
third       # This is the output from the third process
second      # This is the output from the second process
andrea@andrea-laptop:~$ 
[1]-  Done                    echo first    # This is bash telling me that the first background job has quit
[2]+  Done                    echo second   # This is bash telling me that the second background job has quit

इससे और अन्य बुरे प्रभावों से बचने के लिए आपको URL को ठीक से उद्धृत करना चाहिए:

wget -c 'http://downloads.sourceforge.net/project/zorin-os/9/zorin-os-9-core-32.iso?r=http%3A%2F%2Fzorinos.com%2Fdownload9.html&ts=1460659842&something-else'

6
फिर भी एक और कारण है कि आपको कभी भी टर्मिनल टर्मिनल को नेत्रहीन रूप से कॉपी नहीं करना चाहिए ... कोई व्यक्ति url someurl.com/index.php&malicious-command-here बना सकता है और लोग बस उसे चलाकर उसका सिस्टम तोड़ देंगे।
— नजल्ल
हमारी साइट का प्रयोग करके, आप स्वीकार करते हैं कि आपने हमारी Cookie Policy और निजता नीति को पढ़ और समझा लिया है।
Licensed under cc by-sa 3.0 with attribution required.