02-06-2011
Need some help with my homework
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Hi, since I'm relatively new to Unix I need some help. I've installed FreeBSD 8 on a virtual machine and I've done most of the tasks but don't know if I'm right or wrong ;/
Here it goes:
1. Why do folders /bin and /usr/bin usually come out at the first place as an output of the command echo $PATH?
2. Explain what would be the result of the command $ `date`
3. You want to concatenate the two files foo1 and foo2 but you have to put some text from the command line between them too. How would you do that?
4. If a command procedure contains a command:
echo ${d-'*'}
what would come out?
5. Can you use sh < foo.sh instead of sh foo.sh to execute a script?
2. Relevant commands, code, scripts, algorithms:
echo $PATH
$ `date`
echo ${d-'*'}
3. The attempts at a solution (include all code and scripts):
Ok, first of all I don't know why but I can't create files to test some commands ;/ I mean I write for example cat >file1 and it says "Cannot create file1. Read-only file system."
Here are my answers dunno if I'm right or wrong so please help me :]
1. Because in those folders are the most important system scripts, files etc. that are being used when the operating system loads
2. In my case it came out: Thu: not found.
But when I change `` to ' ' it says the correct date. Is that the catch here?
3. Aah maybe:
cat >>foo1 foo2 >foo3 or maybe not?^^
4. It prints out - * ?
5. I'm not sure about that one - maybe you can, because < is used for input
Thanx a lot
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
New Bulgarian University, Sofia, Bulgaria, N.Gadjev, CSCB584 UNIX
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
7 More Discussions You Might Find Interesting
1. Post Here to Contact Site Administrators and Moderators
https://www.unix.com/shell-programming-scripting/113946-scripts.html
Looks like an assignment or homework to me, does it to you? (5 Replies)
Discussion started by: TonyFullerMalv
5 Replies
2. UNIX for Dummies Questions & Answers
1. You have a very large file, named 'ColMe', tab-delimited, you are asked to process. You are told that each line in 'ColMe' has 7 columns, and that the values in the 5th column are integers. Using shell functions (and standard LINUX/UNIX filters), indicate how you would verify that these... (1 Reply)
Discussion started by: mb774
1 Replies
3. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
Hello,
My name is Jordan and studying at the New Bulgarian University in Sofiya. This is my homework but can... (2 Replies)
Discussion started by: freestar
2 Replies
4. Shell Programming and Scripting
1. Write a shell script to print the file names of all files having .txt extension of a given directory after converting to uppercase letters. The input (directory name) should be given as command line argument. The script will also check whether sufficient arguments are passed or not and whether... (1 Reply)
Discussion started by: aninda1989
1 Replies
5. Homework & Coursework Questions
A shell script is a script written for the shell, or command line interpreter, of an operating system. Typical operations performed by shell scripts include file manipulation, program execution, printing text etc.
Shell : In computing, a shell is a piece of software that provides an interface for... (1 Reply)
Discussion started by: ubun
1 Replies
6. Homework & Coursework Questions
plz i need code to search about numbers like this :
962785785698
962795565488
962785321565
962777321684
962795979515
i need code to detect just numbers start with "96278"
i need it in awk !!
thanks (1 Reply)
Discussion started by: eyad mohammad
1 Replies
7. Homework & Coursework Questions
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
2. Relevant commands, code, scripts, algorithms:
Write a command to display lines ending with the... (1 Reply)
Discussion started by: elh009
1 Replies
diff3(1) General Commands Manual diff3(1)
Name
diff3 - 3-way differential file comparison
Syntax
diff3 [-ex3] file1 file2 file3
Description
The command compares three versions of a file, and publishes the ranges of text that disagree, flagged with the following codes:
==== all three files differ
====1 file1 is different
====2 file2 is different
====3 file3 is different
The type of change needed to convert a given range of a given file to some other is indicated in one of these ways:
f : n1 a Text is to be appended after line number n1 in file f, where f = 1, 2, or 3.
f : n1 , n2 c
Text is to be changed in the range line n1 to line n2. If n1 = n2, the range may be abbreviated to n1.
The original contents of the range follows immediately after a c indication. When the contents of two files are identical, the contents of
the lower-numbered file is suppressed.
Options
-3 Produces an editor script containing the changes between file1 and file2 that are to be incorporated into file3.
-e Produces an editor script containing the changes between file2 and file3 that are to be incorporated into file1.
-x Produces an editor script containing the changes among all three files.
Examples
Under the -e option, publishes a script for the editor that incorporates into file1 all changes between file2 and file3 - that is, the
changes that would normally be flagged ==== and ====3. Option -x (-3) produces a script to incorporate only changes flagged ==== (====3).
The following command applies the resulting script to `file1':
(cat script; echo '1,$p') | ed - file1
Restrictions
Text lines that consist of a single `.' defeat -e.
Files
/tmp/d3?????
/usr/lib/diff3
See Also
cmp(1), comm(1), diff(1), dffmk(1), join(1), sccsdiff(1), uniq(1)
diff3(1)