while read loop questionError while running script with nohupRead longest line in file using while read...
Can an old DSLR be upgraded to match modern smartphone image quality
Please help me identify this plane
If a problem only occurs randomly once in every N times on average, how many tests do I have to perform to be certain that it's now fixed?
Why does MS SQL allow you to create an illegal column?
What happens if you do emergency landing on a US base in middle of the ocean?
Humans meet a distant alien species. How do they standardize? - Units of Measure
What does War Machine's "Canopy! Canopy!" line mean in "Avengers: Endgame"?
Why were the Night's Watch required to be celibate?
Applicants clearly not having the skills they advertise
Can The Malloreon be read without first reading The Belgariad?
Filling region bounded by multiple paths
Beginner's snake game using PyGame
Hygienic footwear for prehensile feet?
What is the correct expression of 10/20, 20/30, 30/40 etc?
Accidentally cashed a check twice
Can a magnetic field of a large body be stronger than its gravity?
What is the best option to connect old computer to modern TV
Did Darth Vader wear the same suit for 20+ years?
Will TSA allow me to carry a CPAP?
How to detach yourself from a character you're going to kill?
Explain Ant-Man's "not it" scene from Avengers: Endgame
Get value of the passed argument to script importing variables from another script
Is there a rule that prohibits us from using 2 possessives in a row?
What if you don't bring your credit card or debit for incidentals?
while read loop question
Error while running script with nohupRead longest line in file using while read loop?'while read line do' cause: “syntax error near unexpected token `done'” in Linux bash scriptsed in while read loop doesn't complete commandswhile read line in shell script - how to stop the loop?Infinite while loop issue using readSimplify command lines in scriptBash script aborting for loopTiming out in scripts with usbmountWhile Read Line - Syntax Question
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
Found in a script
{while read logfilename rest
do
LogFileSize=`wc -c $logfilename | awk '{print $1}'`
....
..........
done < /tmp/filelist
}
I'm not sure what rest
is, can anyone explain it?
shell-script
New contributor
add a comment |
Found in a script
{while read logfilename rest
do
LogFileSize=`wc -c $logfilename | awk '{print $1}'`
....
..........
done < /tmp/filelist
}
I'm not sure what rest
is, can anyone explain it?
shell-script
New contributor
add a comment |
Found in a script
{while read logfilename rest
do
LogFileSize=`wc -c $logfilename | awk '{print $1}'`
....
..........
done < /tmp/filelist
}
I'm not sure what rest
is, can anyone explain it?
shell-script
New contributor
Found in a script
{while read logfilename rest
do
LogFileSize=`wc -c $logfilename | awk '{print $1}'`
....
..........
done < /tmp/filelist
}
I'm not sure what rest
is, can anyone explain it?
shell-script
shell-script
New contributor
New contributor
edited 1 hour ago
Jesse_b
15.7k33877
15.7k33877
New contributor
asked 1 hour ago
tapas chakrabartytapas chakrabarty
61
61
New contributor
New contributor
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
In a while read
loop:
The line is split into fields as with word
splitting, and the first word is assigned to the first NAME, the second
word to the second NAME, and so on, with any leftover words assigned to
the last NAME.
This means if your input is something like:
name1
name2 foo
name3
And you were only doing:
while read logfilename
On the second iteration your logfilename
variable would be set to 'name2 foo'
.
Therefore it is relatively common practice for people to create a "trash" variable to collect any potential unwanted input you may encounter. This variable likely wont be used in the script but is just there to ensure logfilename
never gets bad data.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
tapas chakrabarty is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f522077%2fwhile-read-loop-question%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In a while read
loop:
The line is split into fields as with word
splitting, and the first word is assigned to the first NAME, the second
word to the second NAME, and so on, with any leftover words assigned to
the last NAME.
This means if your input is something like:
name1
name2 foo
name3
And you were only doing:
while read logfilename
On the second iteration your logfilename
variable would be set to 'name2 foo'
.
Therefore it is relatively common practice for people to create a "trash" variable to collect any potential unwanted input you may encounter. This variable likely wont be used in the script but is just there to ensure logfilename
never gets bad data.
add a comment |
In a while read
loop:
The line is split into fields as with word
splitting, and the first word is assigned to the first NAME, the second
word to the second NAME, and so on, with any leftover words assigned to
the last NAME.
This means if your input is something like:
name1
name2 foo
name3
And you were only doing:
while read logfilename
On the second iteration your logfilename
variable would be set to 'name2 foo'
.
Therefore it is relatively common practice for people to create a "trash" variable to collect any potential unwanted input you may encounter. This variable likely wont be used in the script but is just there to ensure logfilename
never gets bad data.
add a comment |
In a while read
loop:
The line is split into fields as with word
splitting, and the first word is assigned to the first NAME, the second
word to the second NAME, and so on, with any leftover words assigned to
the last NAME.
This means if your input is something like:
name1
name2 foo
name3
And you were only doing:
while read logfilename
On the second iteration your logfilename
variable would be set to 'name2 foo'
.
Therefore it is relatively common practice for people to create a "trash" variable to collect any potential unwanted input you may encounter. This variable likely wont be used in the script but is just there to ensure logfilename
never gets bad data.
In a while read
loop:
The line is split into fields as with word
splitting, and the first word is assigned to the first NAME, the second
word to the second NAME, and so on, with any leftover words assigned to
the last NAME.
This means if your input is something like:
name1
name2 foo
name3
And you were only doing:
while read logfilename
On the second iteration your logfilename
variable would be set to 'name2 foo'
.
Therefore it is relatively common practice for people to create a "trash" variable to collect any potential unwanted input you may encounter. This variable likely wont be used in the script but is just there to ensure logfilename
never gets bad data.
answered 1 hour ago
Jesse_bJesse_b
15.7k33877
15.7k33877
add a comment |
add a comment |
tapas chakrabarty is a new contributor. Be nice, and check out our Code of Conduct.
tapas chakrabarty is a new contributor. Be nice, and check out our Code of Conduct.
tapas chakrabarty is a new contributor. Be nice, and check out our Code of Conduct.
tapas chakrabarty is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f522077%2fwhile-read-loop-question%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown