Sponsored Content
Full Discussion: Combining two commands.
Top Forums UNIX for Advanced & Expert Users Combining two commands. Post 302251327 by raidkridley on Sunday 26th of October 2008 09:19:06 PM
Old 10-26-2008
Combining two commands.

Is there anyway to achieve "find /home -name "*.bashrc" 2>/dev/null" and "PS1="\n>"" in the same command? I just wanna add a line to the previous command to change the PS1 variable to ">".
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Combining elements of different commands in history

What is the correct format for a single command that would combine portions of 2 different lines in the command history? I'm using a C shell. Here's a simplified command history to clarify: 4 rm file1 5 ls -ld file2 file3 file4 6 cat file 5 With the above history, what would be the... (5 Replies)
Discussion started by: Dbyte
5 Replies

2. Shell Programming and Scripting

combining unix commands and awk program

Dear Experts I am trying to find if it is possible to combine unix commands in awk program. For example if it is possible embed rm or ls or any unix command inside the awk program and while it is reading the file besides printing be able to do some unix commands. I am thinking may be just print... (2 Replies)
Discussion started by: Reza Nazarian
2 Replies

3. UNIX for Dummies Questions & Answers

combining sed commands

I would like to change the lines: originalline1 originalline2 to: originalline1new originalline1newline originalline2new originalline2newline To do this, id like to combine the commands: sed 's/^/&new/g' file > newfile1 and sed '/^/ a\\ newline\\ \\ (2 Replies)
Discussion started by: Dave724001
2 Replies

4. UNIX for Dummies Questions & Answers

combining commands

Hello all, I am trying to list and count all the files of a particular type in any given directory. I can use the commands separately but when I combine them they do not give an output. The command for counting the files is ls -1 | wc -l and for listing all the file of particular type say... (2 Replies)
Discussion started by: BigTool4u2
2 Replies

5. Shell Programming and Scripting

Combining multiple commands

Hi Guys, I am looking to optimze these 5 SSH lines to a single SSH to get my machine to not hang! lol! cat hosts.lst | xargs -n1 -t -i echo 'home/util/timeout 6 0 ssh -q {} top -b > util/{}.top &' >> r_query_info cat hosts.lst | xargs -n1 -t -i echo 'home/util/timeout 6 0 ssh -q {} uname -r... (5 Replies)
Discussion started by: wick3dsunny
5 Replies

6. UNIX for Dummies Questions & Answers

Combining two commands that use sar.

hey can anyone tell me how can i combine these two commands so that it is executed only once, but gives me both the results. IDLE=`sar 30 6 | grep Average | awk '{print $1 $5}' ` sar 30 120 | awk '{print $1" "$5}' >> mailx -m -s "$MSG" xyz@abc.com. (5 Replies)
Discussion started by: Ankur Khatri
5 Replies

7. UNIX for Dummies Questions & Answers

Combining resukts of ls commands

Hi, I have a directory with some XML files in it. I can use wildcards to get the list of XMLs I want say I have following XMLs in same dir Employee1.xml Employee2.xml Employee3.xml and Salary1.xml Salary2.xml Salary3.xml apart from other .txt .dat files etc I want to write a unix... (7 Replies)
Discussion started by: dsrookie
7 Replies

8. UNIX for Dummies Questions & Answers

Help with combining the ls and 'file' commands

I have a directory of 3000 files without extensions (Solaris 5.10). I would like to iterate the file names through the 'file' command and output their mime types (most are pdf or jpg, but a very few might be psd or swf which show simply as 'data') So, I would like the output of the 'ls'... (2 Replies)
Discussion started by: pwallace
2 Replies

9. Shell Programming and Scripting

How to combining awk commands?

I can achieve two tasks with 2 different awk commands: 1) awk -F";;WORD" '{print $2}' file | sed '/^$/d' #to find surface_word 2) awk -F"bw:|gloss:" '// {print $2}' file | sed '/\//!d; s:/*+*: + :g; s:^+::; s: *+ *$::;' #to find segmentation of surface_word Number 1) finds surface_word... (7 Replies)
Discussion started by: Viernes
7 Replies

10. Shell Programming and Scripting

Combining 2 commands

Hello all, I need to send an attachment and text in the body, both in the same Email. Below are two cammand that send the required data in separate Emails. I need to combine them so that I get just 1 Email containing the attachment & text in the body. uuencode ${filename} "${file_}" |... (6 Replies)
Discussion started by: Junaid Subhani
6 Replies
fc(1)							      General Commands Manual							     fc(1)

NAME
fc - Processes the command history list SYNOPSIS
fc [-r] [-e editor] [first[last]] fc -l [-nr] [first[last]] fc [-s] [old=new] [first] STANDARDS
Interfaces documented on this reference page conform to industry standards as follows: fc: XCU5.0 Refer to the standards(5) reference page for more information about industry standards and associated tags. OPTIONS
Uses the editor named by editor to edit the commands. The editor string is a utility name, subject to search via the PATH variable. The value in the FCEDIT variable is used as a default when -e is not specified. If FCEDIT is null or unset, ed is used as the editor. Lists the commands rather than invoking an editor on them. The commands are written in the sequence indicated by the first and last parameters, as affected by -r, with each command preceded by the command number. Suppresses command numbers when listing with -l. Reverses the order of the commands listed (with -l) or edited (with neither -l nor -s). Reexecutes the command without invoking an editor. OPERANDS
Selects the commands to list or edit. The number of previous commands that can be accessed is determined by the value of the HISTSIZE variable. The value of first or last or both is one of the following: A positive number representing a command number; command numbers can be displayed with the -l option. A negative decimal number representing the command that was executed number of commands previously. For example, -1 is the immediately previous command. A string indicating the most recently entered command that begins with that string. If the old=new operand is not also specified with -s, the string form of the first operand cannot contain an embedded equal sign. When the synopsis form with -s is used: If first is omitted, the previous command is used. For the synopsis forms without -s: If last is omitted, last defaults to the previous command when -l is specified; otherwise, it defaults to first. If first and last are both omitted, the previous 16 commands are listed or the previous single command is edited (based on the -l option). If first and last are both present, all of the commands from first to last are edited (without -l) or listed (with -l). Editing multiple commands is accomplished by presenting to the editor all of the commands at one time, each com- mand starting on a new line. If first represents a newer command than last, the commands are listed or edited in reverse sequence, equivalent to using -r. For example, the following commands on the first line are equivalent to the corresponding commands on the second: fc -r 10 20 fc 30 40 fc 20 10 fc -r 40 30 When a range of commands is used, it is not an error to specify first or last values that are not in the history list; fc substitutes the value representing the oldest or newest command in the list, as appropriate. For example, if there are only ten commands in the history list, numbered 1 to 10, the follow- ing commands list and edit, respectively, all ten commands: fc -l fc 1 99 The first occurrence of string old in the commands to be reexecuted is replaced by the string new. DESCRIPTION
The fc utility lists or edits and reexecutes commands previously entered to an interactive shell. The command history list references commands by number. The first number in the list is selected arbitrarily. The relationship of a num- ber to its command does not change except when the user logs in and no other process is accessing the list, at which time the system may reset the numbering to start the oldest retained command at another number (usually 1). When the number reaches an upper limit, either the value in HISTSIZE or 32767 (whichever is greater), the shell wraps the numbers, starting the next command with number 1. However, despite this optional wrapping of numbers, fc maintains the time-ordering sequence of the commands. For example, if four commands in sequence are given the numbers 32766, 32767, 1 (wrapped), and 2 as they are executed, command 32767 is considered the command previous to 1, even though its number is higher. When commands are edited (when the -l option is not specified), the resulting lines are entered at the end of the history list and then reexecuted by sh. The fc command that caused the editing is not entered into the history list. If the editor returns a non-zero exit sta- tus, this suppresses the entry into the history list and the command reexecution. Any command-line variable assignments or redirection operators used with fc affect both the fc command itself as well as the command that results. The following command reinvokes the previous command, suppressing standard error for both fc and the previous command: fc -s -- -1 2>/dev/null NOTES
Users on windowing systems may want to have separate history files for each window by setting HISTFILE to the following: HIST- FILE=$HOME/.sh_hist$$ RESTRICTIONS
Since editors sometimes use file descriptors as integral parts of their editing, redirecting their file descriptors as part of the fc com- mand can produce unexpected results. For example, if vi is the FCEDIT editor, the following command will not work correctly on many sys- tems: fc -s | more EXIT STATUS
The following exit values are returned: Successful completion of the listing. An error occurred. Otherwise, the exit status is that of the commands executed by fc. ENVIRONMENT VARIABLES
The following environment variables affect the execution of fc: This variable, when expanded by the shell, determines the default value for the -e editor option's editor option-argument. If FCEDIT is null or unset, ed is used as the editor. Determines a path name naming a com- mand history file. If the HISTFILE variable is not set, the shell attempts to access or create a file in your home directory. If the shell cannot obtain both read and write access to, or create, the history file, it uses a default mechanism that allows the history to operate properly. Changes made to HISTFILE after the history file has been initialized are not effective. If more than one instance of the shell is using the same history file, it is unspecified how updates to the history file from those shells interact. As entries are deleted from the history file, they will be deleted oldest first. Determines a decimal number representing the limit to the number of previous commands that are accessible. If this variable is unset, a default of 128 is used. Changes made to HISTSIZE after the history file has been ini- tialized are not effective. Provides a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization variables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value, overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes of text data as characters (for example, single-byte as opposed to multibyte characters in arguments and input files). Determines the locale used to affect the format and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of LC_MES- SAGES. SEE ALSO
Commands: sh(1p) Standards: standards(5) fc(1)
All times are GMT -4. The time now is 09:13 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy