[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

regarding unix commands

Posted on 2004-08-08
6
Medium Priority
?
350 Views
Last Modified: 2013-12-26
hi,
  i have queries on some commands.I have listed it below
1. I want to know the Command to know the version of unix and company which developed unix?
2. In wc command there are two optional arg,c- counts the number of bytes m-counts the number  
    of characters.What's the difference between the two option
    I tested with a file test.txt with contents 123\n123\n1
    when i do wc -c  a.txt and wc -m a.txt i get 9 as answer.
3. To find the files in my directory which start with letter 'a' i did the following unix command
    ls -la | grep a* .Im not getting the output.How to do it? * means zero or more characters.
4. Im using a telnet to connect to a remote machine.When i give lp command will the printout goes to
    the printer connected to remote machine or printer connected to the local machine.

 
0
Comment
Question by:pigeon7778
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 

Author Comment

by:pigeon7778
ID: 11746221
I forgot to add one more question to my previous msg.
5. Im giving sh <script name> to run a script.i gave man sh and i saw sh means bourne shell.
   But when i give ps command my shell name shown as ksh.Is my script run by bourne shell or
   kshell.If i change the permission mode of my script as executable and when i run it without
   giving  sh before it what shell it will take? korn or bourne shell.
0
 
LVL 23

Accepted Solution

by:
brettmjohnson earned 80 total points
ID: 11747170
1. 'uname -srv'

2. If the current locale support multibyte characters (Unicode, or LMBCS, etc),
then sizeof(character) != sizeof(byte) and a file may have fewer characters than
it has bytes.

3.  Why not just use the command 'ls -la  a*'  ?
There are several things wrong with your example command 'ls -la | grep a*'
The shell performs filename expansion of parameters before running the program
receiving the filenames, so grep will never see 'a*' as a regular expression.  It will
see instead all the filenames begining with 'a' as its arguments.  The other gross
error is the filename globbing rules are very different than the full regular expressions
supported by grep (even though they share some characters).

4. When you telnet into another machine, your local machine performs as little
more than a dumb terminal.  Your keystrokes are transmitted to the remote host,
and characters appearing on the console of the remote host are transmitted back
to your local machine for display.  When you enter the command 'ls', does it show
the files on the remote host or the local host?  Why would 'lp' be any different?

5. So many shells now have Bourne shell emulation that few Unix systems actually
ship with a true Bourne shell any more.   You can explicitly specify which shell
will be used to execute a script with a "sh-bang" line as the first line of the script:
#!/bin/sh
#!/bin/ksh
#!/bin/bash
#!/bin/csh
etc.
If a shell script lacks a sh-bang line, it executes in your default login shell.  For
more information on shells see:  http://helpme.scudc.scu.edu/shells.html







0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:pigeon7778
ID: 11751970
If i give ps command the below results appear
PID TTY       TIME COMMAND
  4359 pts/ta    0:00 ksh
  4439 pts/ta    0:00 ps
  4358 pts/ta    0:00 telnetd
so ksh is the parent shell.If i dont give anything mentions the shell to use(#!/bin/csh) in my script code "a.sh"  and if i give sh a.sh which shell will execute the script.Is ksh executes the script?
0
 
LVL 23

Expert Comment

by:brettmjohnson
ID: 11753738
It appears that ksh is your current shell, quite probably your login shell.
If you type 'sh a.sh', it will execute the first exectuable program named 'sh'
found on your path.  You can find out which that is by running the command,
'which sh'

0
 

Author Comment

by:pigeon7778
ID: 11759728
a.sh
***
echo `which sh`
echo "hello world"

the script displays
/usr/bin/sh
hello world
Does it mean the default shell is posix shell
                       
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question