Hot answers tagged shell-script
For such simple examples it does not matter where the redirection happens. It's a choice of coding style here. The Bash manual states: The (...) redirection operators may precede or appear anywhere within a simple command or may follow a command. What is a simple command? A simple command is the kind of command encountered most often. It’s just a ...
You can use grep: VARIABLE="$(grep -oE '[0-9]+' outputfile)" The -o flag of grep only prints the matched pattern. -E switches to extented regex. The regex means only match a digit that has 1 or more characters. That digit is saved into the variable. Check it with: $ echo $VARIABLE 10080
From the manpage: A login shell begins by executing commands from the system files /etc/csh.cshrc and /etc/csh.login. It then executes commands from files in the user's home directory: first ~/.tcshrc (+) or, if ~/.tcshrc is not found, ~/.cshrc, then ~/.history (or the value of the histfile shell variable), then ~/.login, and finally ~/.cshdirs ...
Only top voted, non community-wiki answers of a minimum length are eligible