Sponsored Content
Top Forums UNIX for Dummies Questions & Answers This is going to sound dumb but... Post 88312 by flyingpenguin on Wednesday 2nd of November 2005 10:12:55 PM
Old 11-02-2005
Shell programming in sh.

1) Every shell file gegins with #!/[path to shell]/[name of shell]! to use bash, for example you would begin your shell script with

Code:
#!/bin/sh

to use tcsh you could use

Code:
#!/bin/tcsh

2) When you declare variables just type the variable name followed by the = sign. For example to create a variable named NAME and set it to "ME" enter

Code:
NAME="ME"

3) When using a variable in an expression (like an if, and so forth) precede the variable name by $. For example, to ser a variable caled VAR2 to NAME enter:

Code:
VAR2=$NAME

4) You can use commands in shell scripts as you do the shell. The advantage of shell scripts is that you can use macros. For example to list all files and all directories in the current directory that begin with NAME enter

ls $NAME*

The following file gets all of the files returned by ls and stroes them in foo. after that, it takes the last file listed by ls and stores it in final value. Then it prints the value of finalvalue.

Code:
finalvalue=""

for foo in `ls`
do
  echo $foo
done

finalvalue=$foo

echo "$finalvalue"


I would list more, but I ran out of time. Hope this helps.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

dumb question

My problem is as follows: I have to write a korn shell script which will run mutiple java applications one after one. For example, I will execute the java application A first, after it is done I will run application B. My question is how do I do this? How does my korn shell script know that... (1 Reply)
Discussion started by: madhab99
1 Replies

2. UNIX for Dummies Questions & Answers

Dumb thing to do

I'm writing for a friend. He has a SPARC system at home that has Solaris 7 on it. He did not yet create a user on it and has not set the CONSOLE to allow the root user to log in remotely. Now, something happened and the system will not even boot to the Boot PROM. How can he get into the system... (4 Replies)
Discussion started by: danh
4 Replies

3. UNIX for Dummies Questions & Answers

really dumb question...

ok i decided to go with Mandrake so i went to the site to download it and that took me to a mirror site. ok. so once i get there were can i find the install file(s) that i need? i only see a series of folder and files. the ones that say intall are instructions but i don't see the files themselves.... (3 Replies)
Discussion started by: justchillin
3 Replies

4. UNIX for Dummies Questions & Answers

Two dumb questions

It's obvious I'm a newbie after today, so I come to ask two questions. Or, solutions to two problems, anyway. I'm running KDE 3.1 on SuSE Linux 8.2, for reference. 1. After downloading programs for KDE and running 'configure', I infallably get an error that states: 'in the prefix, you've... (1 Reply)
Discussion started by: Darkstripes
1 Replies

5. UNIX for Dummies Questions & Answers

Ok really dumb question but...

Does anyone have detailed info on how to download the files. I go to www.freebsd.com and then i dont know what to do. I dont know why i dont know but im drawing a complete blank so is there anyone that can provide a step by step procedure for downloading/installing Linux? :confused: :confused: (3 Replies)
Discussion started by: Corrail
3 Replies

6. UNIX for Dummies Questions & Answers

Another dumb question...

Probably a really easy one for you guru's out there...:rolleyes: I need to make sure the reverse address lookup daemon in rarpd, is running. How do I do so? :confused: Did a grep for the process but couldnt find it, also looked in all the normal places, /bin etc... Cheers (1 Reply)
Discussion started by: JayC89
1 Replies

7. UNIX for Dummies Questions & Answers

Another dumb question but...

When getting a listing of files using "ls -l", my output shows the permissions, #oflinks???, owner, group, size, month-day-time, and file. In the example below, how would I know what year the file was last modified? -rw-rw-r--, 28, root, root, 2048, Oct 28 15:10, somefile.txt (2 Replies)
Discussion started by: KGee
2 Replies

8. UNIX for Dummies Questions & Answers

this is a very dumb question...i know... :(

hi, when we do an "ls -l" on a directory, we get the listing of the contents of that dir... what is the meaning of some numbers...example in ; -rw-r--r-- 1 idr supp 0 Feb 18 19:41 dmesg drwxrwsrwx 2 root sys 96 Dec 27 15:31 test09 drwxr-xr-x 3 bin ... (1 Reply)
Discussion started by: cromohawk
1 Replies

9. UNIX for Dummies Questions & Answers

i have few dumb questions..

i wanna learn UNIX so 1. how should i start? 2. which book should i use? 3. which environment is best for learning n then getting job? thanx in advance........:) (1 Reply)
Discussion started by: vjai
1 Replies

10. What is on Your Mind?

i have few dumb questions..

i wanna learn UNIX so 1. how should i start? 2. which book should i use? 3. which environment is best for learning n then getting job? thanx in advance........:) (1 Reply)
Discussion started by: vjai
1 Replies
MIXER(8)						    BSD System Manager's Manual 						  MIXER(8)

NAME
mixer -- set/display soundcard mixer values SYNOPSIS
mixer [-f device] [-s | -S] [dev [[+|-]lvol[:[+|-]rvol]]] ... mixer [-f device] [-s | -S] recsrc ... mixer [-f device] [-s | -S] {^|+|-|=}rec rdev ... DESCRIPTION
The mixer utility is used to set and display soundcard mixer device levels. It may also be used to start and stop recording from the sound- card. The list of mixer devices that may be modified are: vol, bass, treble, synth, pcm, speaker, line, mic, cd, mix, pcm2, rec, igain, ogain, line1, line2, line3, dig1, dig2, dig3, phin, phout, video, radio, and monitor. Not all mixer devices are available. Without any arguments, mixer displays the current settings for all supported devices, followed by information about the current recording input devices. If the dev argument is specified, mixer displays only the value for that dev. To modify the mixer value dev, the optional left and right channel settings of lvol[:rvol] may be specified. The lvol and rvol arguments may be from 0 - 100. Omitting dev and including only the channel settings will change the main volume level. If the left or right channel settings are prefixed with + or -, the value following will be used as a relative adjustment, modifying the cur- rent settings by the amount specified. If the -s flag is used, the current mixer values will be displayed in a format suitable for use as the command-line arguments to a future invocation of mixer (as above). The -S flag provides the above output without mixing field separators. To change the recording device you use one of: ^rec toggles rdev of possible recording devices +rec adds rdev to possible recording devices -rec removes rdev from possible recording devices =rec sets the recording device to rdev The above commands work on an internal mask. After all the options have been parsed, it will set then read the mask from the sound card. This will let you see EXACTLY what the soundcard is using for the recording device(s). The option recsrc will display the current recording devices. The option -f device will open device as the mixer device. FILES
/dev/mixer the default mixer device SEE ALSO
cdcontrol(1), sound(4) HISTORY
The mixer utility first appeared in FreeBSD 2.0.5. AUTHORS
Original source by Craig Metz <cmetz@thor.tjhsst.edu> and Hannu Savolainen. Mostly rewritten by John-Mark Gurney <jmg@FreeBSD.org>. This manual page was written by Mike Pritchard <mpp@FreeBSD.org>. BSD
June 2, 2014 BSD
All times are GMT -4. The time now is 01:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy