Here you go:
TWOWEEKSAGO=$( expr $(date +%U) - 2 )
echo $TWOWEEKSAGO
Or, alternatively:
Type: Posts; User: Portmanteaufu; Keyword(s):
Here you go:
TWOWEEKSAGO=$( expr $(date +%U) - 2 )
echo $TWOWEEKSAGO
Or, alternatively:
Huh! Welp, I learned something today.
I thought that what I was describing was the default behavior because shells send SIGHUP to their child processes when they die -- turns out you have to set...
No, I didn't. I was commenting on how fork() works in Linux. If the OP wants to guarantee that the child processes get an opportunity to run, (s)he needs to use wait().
Causing the parent program...
The parent process needs to call wait(...) or waitpid(...) for each of the forked child processes.
If the parent doesn't wait for the children to complete, it will exit before they get a chance...
Hrm -- I'm not sure I understand what you're asking. Could you try to be a little more specific?
The short answer is "no". Without writing a pretty complicated program that could take in the...
Welcome to the forums!
This book will teach you POSIX shell scripting -- a set of shell commands that will work with a lot of different shells (bash, tcsh, ksh, etc).
This book will teach you a...
Sounds like a fun script. :D
import urllib # Library that does web page requests
# Request a given web page
page = urllib.urlopen("http://dictionary.reference.com/browse/example")
# Read...
Feel free to ask for help on smaller parts of your problem. (How to make a function, what a parameter is and how to pass one, etc.) At the moment you seem to be asking us to write the code for you,...
There are a variety of approaches to this, and which one you might pick depends heavily on a number of factors. How complex is the HTML being read? What would you like to do with the text once you've...
I strongly suspect that the reason you haven't been helped on this already is that it sounds like a homework problem. Is that the case?
Absolutely correct. Poorly worded on my part, good catch!
I've drawn some ASCII diagrams to illustrate what's happening at each point in the code.
[ ] <--- a
Here's a pretty comprehensive explanation that includes example code.
Your post reminded me of an article that I read a long while back that warned of the complications inherent to trying to parse HTML using regular expressions.
If you aren't too tied to the idea...
You can have your CGI script simply provide a Location header as its sole output.
e.g.
#!/usr/bin/python
print("Location: /some/thank_you/page.html\n")
Note that if you output anything...
Other useful directory navigation tricks:
Return to your home directory
cd
Return to the previous directory (not necessarily the parent directory)
cd -
(Note: this only works one time....
Both signs do different things depending on their context, but I'll take a guess as to where you're seeing them.
When printing, a comma is used to separate each item in a list of parameters you'd...
Isn't it so satisfying when you manage to get it done in one command? :D
I'd like to mention that there is a valuable distinction to be made between 'Learning Bash' and 'Learning common Unix...
cat yourfile.txt | sed "s/''/NULL/g" > newfile.txt
That will replace all '' instances with NULL. Or do you only want to change the 59th field? (i.e. Do you want the 43rd field to stay as ''...
With respect to the issue of a "one linux" movement, I think you'll find that your proposal is rather impractical. Consider this example:
I'm a huge fan of Arch Linux. Do you know what packages it...
Yup! I can't imagine ever running into a scenario in which I needed something more random than /dev/random.
o_O Wow! That would be very impressive. I am assuming you're talking about hardware on computers used by, say, well-funded astrophysics labs? I have yet to see cosmic-radiation-interpreting modules...
Entirely true! :D
I'm not saying that /dev/random is easily predictable. I'm saying that while computers follow a very, very complicated procedure to produce random numbers, they're still...
/dev/random also uses a pre-defined way of producing "random" numbers. To be truly random, there would have to be absolutely no way of predicting what the next number it would spit out would be. If I...
In OpenOffice Writer:
File --> Export to PDF