Archive for the ‘shell scripting’ Category
Monday, February 14th, 2011
Suppose you have a script in PHP and you want to print on the system's default printer, you can use the function
system (<command>, $retval)
The following example shows the printing of a content including a variable coming from the PHP script:
system('echo "'.$message.'"|lpr -o page-left=35 ', $retval );
Posted in linux, PHP, shell scripting | No Comments »
Saturday, October 23rd, 2010
Note to self, because this is something I want to look at sooner or later... therefore I'll post it here.
This looks like a very good intro tutorial: http://www.makeuseof.com/tag/learn-automate-mac-applescript-part-1-introduction/
Kudos to MakeUseOf!
Posted in Mac, shell scripting | No Comments »
Thursday, May 27th, 2010
Memo to self...
Posted in linux, shell scripting, ssh | No Comments »
Monday, January 18th, 2010
This is something not so easy to find on the internet, and once again Linux shows its immense power in the simplest way: CLI. Question: I have a .ISO file representing the image of a DVD and I want to know the LABEL of that DVD. Answer: Issue ...
Posted in linux, shell scripting | No Comments »
Thursday, December 31st, 2009
Although it could seem an oxymore, sort something in randomic order might be usefl sometimes. Give a look to the script below, which I’m writing here for future reference. #!/bin/bash # # This script creates a list of file or symbolic link to ...
Posted in linux, shell scripting | No Comments »
Sunday, November 29th, 2009
I don't consider myself a script guru, but sometimes I like to create small pieces of bash code to ease operations on my linux box... and I guess it's good idea to note here some of the recent solutions I've found for later remembering.
I'll try to comment them, so that ...
Posted in linux, shell scripting | No Comments »
Tuesday, March 24th, 2009
Situation: I have multiple files with extension .sh.modified and I need to rename them all into .sh extension. Solution: for file in *.sh.modified; do mv ${file} ${file%sh.modified}.sh; done
Posted in shell scripting | No Comments »
Saturday, March 21st, 2009
Made this small script for this purpose… #!/bin/bash # # Script to check a directory and write in file the new files # since last check. # ...
Posted in linux, shell scripting | No Comments »
Tuesday, March 10th, 2009
In a world of Perl, sed seems to be an archaic method of doing things reserved to the real brave geeks! But sometimes sed does perfectly fantastic job, like it did for me few minutes ago… with some caveats. My goal was to replace $i with the value ...
Posted in shell scripting | No Comments »
Tuesday, February 3rd, 2009
You might need to do something with a list of files contained in a file… and maybe these file names include spaces, therefore using a standard for i in `cat filename` do echo $i done does not work ...
Posted in linux, shell scripting | No Comments »