473,396 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

linux command in C/C++

doing second year course in uni, just had a test.
one of the question is asking soemthing like with the following shell command:

cat ./thing1 | ./thing2 ./thing3 `./thing4`

Please choose one:
a) thing1 thing2 thing3 are probably programs and thing4 is a data file
b) thing1 thing2 thing4 are probably programs and thing3 is a data file
c) thing2 thing4 are probably programs and thing1 thing3 are probably data files
d) thing2 thing3 thing4 are probably programs and thing1 is a data file
e) thing1 thing2 thing3 thing4 are probably all programs


i was told that the correct answer is c, but why?
and any1 could explain the ./ infront of thing1, plz? isn't that a data file? why?
thanks
Sep 13 '07 #1
3 1525
gpraghuram
1,275 Expert 1GB
doing second year course in uni, just had a test.
one of the question is asking soemthing like with the following shell command:

cat ./thing1 | ./thing2 ./thing3 `./thing4`

Please choose one:
a) thing1 thing2 thing3 are probably programs and thing4 is a data file
b) thing1 thing2 thing4 are probably programs and thing3 is a data file
c) thing2 thing4 are probably programs and thing1 thing3 are probably data files
d) thing2 thing3 thing4 are probably programs and thing1 is a data file
e) thing1 thing2 thing3 thing4 are probably all programs


i was told that the correct answer is c, but why?
and any1 could explain the ./ infront of thing1, plz? isn't that a data file? why?
thanks
As told by u C is the right answer.
./ refers to the current directory.

Raghuram
Sep 13 '07 #2
sicarie
4,677 Expert Mod 4TB
As told by u C is the right answer.
./ refers to the current directory.

Raghuram
Right, but not entirely complete. The '.' refers to the current directory, the dot-slash together ( ./ ) mean "run in this directory," and will execute the programs/commands that are associate with things[1-4].
Sep 13 '07 #3
mac11
256 100+
doing second year course in uni, just had a test.
one of the question is asking soemthing like with the following shell command:

cat ./thing1 | ./thing2 ./thing3 `./thing4`

Please choose one:
a) thing1 thing2 thing3 are probably programs and thing4 is a data file
b) thing1 thing2 thing4 are probably programs and thing3 is a data file
c) thing2 thing4 are probably programs and thing1 thing3 are probably data files
d) thing2 thing3 thing4 are probably programs and thing1 is a data file
e) thing1 thing2 thing3 thing4 are probably all programs


i was told that the correct answer is c, but why?
and any1 could explain the ./ infront of thing1, plz? isn't that a data file? why?
thanks
My take on it:

1. thing1 is likely to be a data file because it is being cat'ed - you can cat a program but that would be useless, usually if something is cat'ed it's a data file

2. thing2 is likely a program because it is having input piped to it - it makes no sense to pipe input to a data file (thats pipe '|' , not re-direct '>')

3. thing3 is likely a data file because it comes directly after thing2 without any pipe or semicolon or whatever that commonly is used in command to hook programs together in the command (looks like thing3 is a parameter to thing2)

4. thing4 is likely a program because it is surrounded by ` this indicates that the output of thing4 is also used as arguments to thing2
Sep 13 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Paolo Scolamacchia | last post by:
Hi everybody, this is my environment : Apache is installed on a Linux server (RedHat9A) and I launch the browser on a PC running WindowsXP to execute php scripts on the Linux server. I would run...
0
by: Google Mike | last post by:
After a lot of thought and research, and playing with FreeTDS and InlineTDS, as well as various ODBC connections, I have determined that the fastest and cheapest way to get up and going with PHP on...
4
by: Jhuola Hoptire | last post by:
Just installed J2RE 1.4.2 on a Linux server. I am very knew to the POSIX world. I couldn't dig-up much in the docs or via google about the following: 1 - Is there a standard way to make sure...
0
by: Jim Williams | last post by:
I am not able to get MYSQL running on Suse Linux Enterprise Server. I tried stopping with the command mysqld and it reported, "Shtudown Complete." Then when I tried to restart it with the...
383
by: John Bailo | last post by:
The war of the OSes was won a long time ago. Unix has always been, and will continue to be, the Server OS in the form of Linux. Microsoft struggled mightily to win that battle -- creating a...
4
by: Tim Golden | last post by:
Tim Golden enlightened us with: > > Well, I'm with you. I'm sure a lot of people will chime in to point > > out just how flexible and useful and productive Linux is as a > > workstation, but every...
1
by: srihari | last post by:
Hai, I am trying to install IBM DB2 8.1 on Red Hat linux 8.0. My machine is Intel XEON 64bit. The installation went well except for the creation of tools catalog. When I tried to install the tools...
3
by: Bruno LIVERNAIS | last post by:
Hi, We are currently installing a DB2 V9 ESE on a Linux server (RHEL4U4-x86_64). Installation runs successfully on each node. Database user environment is OK and the instance is well created. To...
10
by: Justin | last post by:
We have a simple shell script called testsp.sh (located at /home/ userid) Within the shell script, the following command is called: db2 -tvf callsp.sql When the shell script is run in command...
2
jwwicks
by: jwwicks | last post by:
C/C++ Programs and Debugging in Linux This tutorial will give you a basic idea how to debug a program in Linux using GDB. As you are aware Visual Studio doesn’t run on Linux so you have to use...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.