I have I think I understand whats happening in 2nd and 4th for loops. But I do not understand why 1 was not printed in 1st and 3rd for loops. The whole idea of IFS is confusing to me in general. Answer When you say $var_name then 1 is interpreted as a separator and hence you see the string as
Tag: linux
How to wait for the dd command to finish copying before continuing my script?
Title pretty much nailed it, Im copying files to a flash drive and then doing some things to those files. Well I have noticed that after running the dd command the flash drive is still flashing and not all the files are on the device. Does anyone know how to maybe run a simple loop (in script) to wait on
starting apachectl from bash
I am writing a bash file. I need to start apachectl from my bash file. so i wrote: When I run it with root, an error occurred: I searched and I found that, I should be super user with su – not su Now, I want to know: why this error occurred? How could i run it with su? Answer
Convert MediaWiki wikitext format to HTML using command line
I tend to write a good amount of documentation so the MediaWiki format to me is easy for me to understand plus it saves me a lot of time than having to write traditional HTML. I, however, also write a blog and find that switching from keyboard to mouse all the time to input the correct tags for HTML adds
iMacros + FF : Linux, command line
I want to run iMacros script with Firefox, under Ubuntu, by specifying the script in the command line. Unfortunately, the browser only opens the file as text and not runs it… Any clue? Answer You should manually add the macro to your browser then save it under a name of your choice. Then you can call it…
Fixing file permissions after modifying in C++?
I’m saving my data in the executable file of the program. I copy it to a temporary file, overwrite a part starting at a ‘magic string’ and rename it to the original. I know this is a bad idea, but I’m doing it just for experimenting. I got everything to work so far, except for that I h…
What is %gs in Assembly
void return_input (void) { char array[30]; gets (array); printf(“%sn”, array); } After compiling it in gcc, this function is converted to the following Assembly code: push %ebp mov %esp,%ebp sub $0x28,%esp mov %gs:0x14,%eax mov %eax,-0x4(%ebp) xor %eax,%eax lea -0x22(%ebp),%eax mov %eax,(%esp) cal…
Run a persistent process via ssh
I’m trying to start a test server via ssh but it always dies once i disconnect from ssh. Is there a way to start a process (run the server) so it doesn’t die upon the end of my ssh session? Answer As an alternative to nohup, you could run your remote application inside a terminal multiplexor, such…
How to find out which USB-RS232 device is on which tty?
I have two different USB devices based on the same USB-RS232 chips. When I plug those in the USB they are mounted to /dev/ttyUSB0…3 My problem is how, inside a script, I can find out which one is on what tty? Using lsusb I can differentiate them: And using dmesg I can tell where they were mounted: But &…
cURL Simple File Upload – 417 Expectation Failed
I have a problem with a simple file upload post with cURL… I did it so many times but in this case I always get “417 Expectation Failed” from server. When I try to post with my browser it works 100% but with cURL not. That’s my configuration: My simple test form that works: here the im…