See this page for an explanation of the purpose of this list, and how it relates to studying for exams.
~/public_html subdirectory.~/public_html
chmod -R 755 ~/public_html
someUnixCommand -foo -bar -fum
# now test the exit status of that command
if [ $? -eq 0 ]
then
doSomethingBasedOnExitStatusBeingZero
fi
chmod 700 script.sh chmod u+x script.sh
#!/bin/sh
echo "This script will now start up the web server"
CP=/bin/cp USER=pconrad CURL=/usr/local/bin/curl URL=http://copland.udel.edu/~$USER/cisc474 echo "About to see if the web page $URL for user $USER is accessible" $CURL -f $URL
1> and you can redirect standard error with the syntax
2>. In the example below, the first two lines set up variables to store the
path to a utility called curl, and a URL to be retrieved. The third line runs the curl utility
to retreive a web page, and stores the standard output of the curl command
in a file called page.html, and stores the standard error messages in a file called page.log.
The fourth line redirects both standard output and standard error to /dev/null, which means
they should be discarded. In the latter case, since all output is discarded, the result of
the operation is returned in a status code, which is retrieved by the expression $?.CURL=/usr/local/bin/curl URL=http://www.somehost.com $CURL $URL 1>page.html 2>page.log $CURL -f $URL 1>/dev/null 2>/dev/null CURL_RETURN_STATUS=$?
CURRENT_HOST=`hostname
[ symbol and before the
] symbol are required:
if [ $RETURN_STATUS -eq 0 ]
then
echo "Successful"
else
echo "Failure"
fi
Another option for the "then" part is to use a semicolon and put it on the same lines, as follows:
if [ $RETURN_STATUS -eq 0 ] ; then
echo "Successful"
else
echo "Failure"
fi
For the exam, you are not required to learn all of the operators that can be used in place of -eq, however
however it is good to know -eq, -ne, -gt, -ge, -lt, -le. All of those compare numbers. The regular = and != operators
also exist for comparing strings. The man page for "test" (i.e. man test) lists the full set of what
can go inside the square brackets. The latest version of cygwin (http://www.cygwin.com has a pretty good implementation of X11 for windows in it.
The following might not be "optimal", but it worked for me:
ssh -X username@strauss.udel.edu
or
ssh -Y username@strauss.udel.edu
to get logged onto strauss. (See "X11 forwarding on strauss", below, for more information.) Once on strauss, type
xterm &
to open up additional xterms.ssh -X username@hostnameSome programs may not work with the
-X parameter, giving errors such as:
X Error of failed request: BadWindow (invalid Window parameter) Major opcode of failed request: 25 (X_SendEvent) Resource id in failed request: 0xa0000d Serial number of failed request: 88 Current serial number in output stream: 89In that case, use so-called "trusted X11 forwarding", which is marginally less secure, but more backwards compatible.
ssh -Y username@hostnameI do not have a good reference for the exact differences between -X and -Y and the security risk involved; I would welcome contributions on this point.