Open main menu

CDOT Wiki β

Changes

OPS435 Test1 Practice - Bash

1,374 bytes added, 21:34, 22 February 2016
no edit summary
"filename"
Note that the "test -d" command will return true when applied to a directory and false otherwise.
 
== Resize images ==
 
This is the syntax for the convert command to resize an image original.jpg to a new image resized.jpg which is 1024 by 768 pixels large:
 
<source lang="bash">convert original.jpg -resize 1024x768 resized.jpg</source>
 
Write a script that will go through all the images in the current directory and make resized (1024x768) versions of each of them. Each existing image has a .jpg extension. New images should have a -small suffix. For example original.jpg should get a pair original-small.jpg
 
== Write HTML for images ==
 
In the current directory you have a pile of jpg images. You want to generate some code to put them all in a webpage. The HTML to show one image looks like this (the quotes around the filename can be single or double quotes):
 
<source lang="html4strict"><img src="imagefilename.jpg" /></source>
 
Write the script that will generate one big HTML file with an <img> tag for every image in the current directory.
 
== Write HTML for small images with links ==
 
This one is pretty advanced, but take it on if you want a challenge.
 
The same as above, but the current directory has two types of images: regular sized and small. Your generated HTML should look like this (again - either single or double quotes are fine for HTML):
 
<source lang="html4strict"><a href="imagefilename.jpg"><img src="imagefilename-small.jpg" /></a></source>