Sponsored Content
Homework and Emergencies Homework & Coursework Questions Need some help with my homework Post 302494238 by iLeeT777 on Sunday 6th of February 2011 11:06:06 AM
Old 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

Homework?

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

Homework :(

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

Homework Help.

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

Homework

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

Please help me with my homework!!!

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

Homework

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

Homework Help

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
mktemp(3C)						   Standard C Library Functions 						mktemp(3C)

NAME
mktemp - make a unique file name from a template SYNOPSIS
#include <stdlib.h> char *mktemp(char *template); DESCRIPTION
The mktemp() function replaces the contents of the string pointed to by template with a unique file name, and returns template. The string in template should look like a file name with six trailing 'X's; mktemp() will replace the 'X's with a character string that can be used to create a unique file name. Only 26 unique file names per thread can be created for each unique template. RETURN VALUES
The mktemp() function returns the pointer template. If a unique name cannot be created, template points to a null string. ERRORS
No errors are defined. EXAMPLES
Example 1 Generate a filename. The following example replaces the contents of the "template" string with a 10-character filename beginning with the characters "file" and returns a pointer to the "template" string that contains the new filename. #include <stdlib.h> ... char *template = "/tmp/fileXXXXXX"; char *ptr; ptr = mktemp(template); USAGE
Between the time a pathname is created and the file opened, it is possible for some other process to create a file with the same name. The mkstemp(3C) function avoids this problem and is preferred over this function. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Safe | +-----------------------------+-----------------------------+ SEE ALSO
mkstemp(3C), tmpfile(3C), tmpnam(3C), attributes(5), standards(5) SunOS 5.11 15 Sep 2004 mktemp(3C)
All times are GMT -4. The time now is 09:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy