Sponsored Content
Top Forums Shell Programming and Scripting Assigning Variable to Line Numer in nl Post 302759407 by horhif on Tuesday 22nd of January 2013 09:04:14 AM
Old 01-22-2013
Assigning Variable to Line Numer in nl

hi,

i'm creating a little menu for some users.

i'm running the command:

Code:
du -a /apps | sort -n -r | head -n 10 | nl

i then get the top 10 files by size in the /apps directory

the output is like this:

1 101415752 /apps
2 89188064 /apps/userA
3 74521335 /apps/userA/export
4 47999710 /apps/UserB

how do I assign a these outputs to variables?

so if the user selects 4, they move (cd) to /apps/UserB ??

thanks for any help
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Assigning a value to variable

Another newbie to Unix scripting Q.. How do you assign a value resulting from a command, such as awk, to a variable. I am currently trying:- $awk '{print $1}' file1 > variable1 with no change to $variable1. The line: $awk '{print $1}' file1 does print the first line of the... (3 Replies)
Discussion started by: sirtrancealot
3 Replies

2. UNIX for Advanced & Expert Users

Max numer of connections per sshd

Hi people, How many ssh or scp connections will an sshd process allow to conenct? I'm hoping this is an easy question. Linux 2.6.16.21-0.8-smp x86_64 GNU/Linux I have a Linux server that has spawned 34 sshd processes, thought this doesn't seem to be enough. The server is used for... (3 Replies)
Discussion started by: nhatch
3 Replies

3. Shell Programming and Scripting

Assigning value to a variable

Is there any difference between: set variable=39 and variable=39 (1 Reply)
Discussion started by: proactiveaditya
1 Replies

4. UNIX for Dummies Questions & Answers

Assigning the output of a command to a variable, where there may be >1 line returned?

Hello I am using unix CLI commands for the Synergy CM software. The command basically searches for a folder ID and returns the names of the projects the folder sits in. The result is assigned to a variable: FIND_USE=`ccm folder -fu -u -f "%name"-"%version" ${FOLDER_ID}` When the command... (6 Replies)
Discussion started by: Glyn_Mo
6 Replies

5. Shell Programming and Scripting

Assigning last line to variable in expect

As part of an expect script, I have to convert a strange user ID to a conventional UNIX ID. To do this, I read the contents of a file and do a little awk magic. Here's that bit of the expect script: send "awk 'NF == 10 && \$NF == strange_user_id {print \$(NF-2)}' file_with_my_info\r" expect... (0 Replies)
Discussion started by: treesloth
0 Replies

6. Shell Programming and Scripting

Removing a character from a variable and assigning it to another variable?

Hi folks. I have this variable called FirstIN that contains something like this: 001,002,003,004... I am trying to assign the content of this variable into ModifiedIN but with the following format : 001 002 003 004...(changing the commas for spaces) I thought about using sed but i am not... (17 Replies)
Discussion started by: Stephan
17 Replies

7. Shell Programming and Scripting

how to Read a file and assigning each line to a variable?

Friends, I have a file output.txt with values as below: 092307135717 061910135717 I want to know how to read this file and then assign each value to a variable. say like var1=092307135717 var2=061910135717 So that I can use this VAR1 and Var2 in the shell script for further processing.... (3 Replies)
Discussion started by: shyamaladevi
3 Replies

8. Shell Programming and Scripting

problem in assigning value to variable have value fo other variable

my script is some thing like this i11="{1,2,3,4,5,6,7,8,9,10,11,}" echo "enter value" read value ..............suppose i11 x="$value" echo "$($value)" .............the echo should be {1,2,3,4,5,6,7,8,9,10,11,} but its showing "i11" only. plz help me out to get desired... (10 Replies)
Discussion started by: sagar_1986
10 Replies

9. Shell Programming and Scripting

Assigning value to a variable

Unable to get the value to a variable. set -x cd $HOME echo "Enter the server name" read a echo $a i=4 j=1 k = ps -ef | awk '/server1/{ print $4 }' | tail -$i | head -$j` echo $k When I do the same in command line it works, however the same does not work when I provide that in the... (1 Reply)
Discussion started by: venkidhadha
1 Replies

10. Shell Programming and Scripting

Awk: Assigning a variable to be the value of FNR at a certain line

Sorry for the probably strangely worded title but I don't really know how else to put it. Background context: Post processing LAMMPS simulation data. tl;dr: I'm making two spheres collide, every defined timestep the simulation outputs a bunch of data including total energy of the particles,... (10 Replies)
Discussion started by: ThomasP
10 Replies
TALAGENT(8)						    BSD System Manager's Manual 					       TALAGENT(8)

NAME
talagent -- helper agent for the Transparent App Lifecycle feature. SYNOPSIS
talagent [command [arguments]] DESCRIPTION
The talagent daemon provides services related to the Transparent App Lifecycle feature. talagent may also be run manually as a command line tool to output information about persistent state. The options are as follows: -help Outputs usage information. -dump bundle_id_fragment Outputs the persistent state of an application whose bundle ID contains the given fragment, case insensitive ("textedit" for example). You may also pass a path directly to the app's persistent state directory, usually in ~/Library/Saved Application State. -launch bundle_id This launches an app (in this case, TextEdit) in a manner approximating how apps get launched at login. You can pass either a bundle ID fragment or a path to an app. The app is maintained stopped until you hit return in the launching window (or until it receives SIGCONT). This is the easiest way to test the login scenario without needing to log in. -casinfo [ASN] With no arguments, outputs summary information about all apps. With one argument (an ASN), outputs the CAS record for that app. -memory_pressure Simulates memory pressure, which may cause apps that support automatic termination to exit. This does not actually allocate any memory. -refresh_encryption Rotates the bitmap encryption key, and attempts to cross-encrypt all existing window bitmaps under the new key. This is done periodically by talagent. HISTORY
First appeared in Mac OS X 10.7 macOS September 1, 2010 macOS
All times are GMT -4. The time now is 05:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy