Sponsored Content
Top Forums Shell Programming and Scripting sh shell user input and stote it to a array Post 302145420 by fpmurphy on Wednesday 14th of November 2007 05:44:11 AM
Old 11-14-2007
OK, here is an example.

#!/bin/ksh

set -A parms $*
print "You supplied ${#parms[@]} parameters:"

echo 'Enter a line'
read x
echo 'You entered this line: ' $x
set -A rarray $x
print "You entered ${#rarray[@]} items"
print ${rarray[0]}
print ${rarray[1]}
print ${rarray[2]}
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Accepting user input in c shell

i need to accept the user input in my c shell script before executing next command. i have the following code which ask for user input, but does not store this value. set req echo " Enter your input(Y/N)?" read req if (req = Y) echo " print $req" else echo " print $req" ... (3 Replies)
Discussion started by: skumar11
3 Replies

2. UNIX for Dummies Questions & Answers

How to display values from user input array?

Hi all, I wrote a script that reads inputs from user and store in array named "input". The number of elements in the array is not fixed - determined only after user exit the while loop that reads the array values : x=1 echo "Enter first value" read input while } != "exit" ] do ... (1 Reply)
Discussion started by: luna_soleil
1 Replies

3. Programming

How to pass C array as input to Shell script

Hi, In the below C code , i want to pass the array to a unix shel script. my script should called as ex myscript 1,2,3 #include <stdio.h> int main() { int a={1,2,3}; } Thanks, Arun (1 Reply)
Discussion started by: arunkumar_mca
1 Replies

4. Shell Programming and Scripting

User Input Shell Script

Hello I am trying to create a user input shell scipt. The objective is user should enter the circuit number and the input is saved in a log file. If the user does not enter anything then the question should prompt it until the circuit no. is entered. Can any one please correct the code below.... (3 Replies)
Discussion started by: sureshcisco
3 Replies

5. Shell Programming and Scripting

Assign user input to already declared array

What I am doing is creating a top menu, which a user will select a choice with a number entry. That number corresponds to a string in an array. I then want to assign that response to another array I've already declared. For example: #!/bin/bash colors=(red blue yellow) red=(cherry fire)... (2 Replies)
Discussion started by: Akilleez
2 Replies

6. Shell Programming and Scripting

every time user input create array perl

Hi, How to create array every time user input and store user input and display all array print " Enter input " my @input = split(' ', $input) chmop($input = <STDIN>; foreach ($input) { @array= @input; } print @array"\n"; (1 Reply)
Discussion started by: guidely
1 Replies

7. Shell Programming and Scripting

create an array which can store the strings from the user input in shell script

I want to create an array which can store the strings from the user input in shell script . example :- I want to store the 5 fruits name in a single array which the user provides . (1 Reply)
Discussion started by: Pkast
1 Replies

8. Shell Programming and Scripting

User input for shell

I still cannot figure out how to get this read command to work. I want the script to ask questions when prompted, and the user to enter a response. Based on response it will continue or exit. I have not worked with this type of script before so I am almost clueless on what to do, and so far google... (6 Replies)
Discussion started by: bigbenn
6 Replies

9. Shell Programming and Scripting

Shell read command is not waiting for user input

Hi, i am working on one automation , for that i have writing one shell program that take user input in "while read line" block. but read command is taking value that is readed by While block. while read line; do command 1; command 2 echo -n "Do you want to continute > " read rsp... (2 Replies)
Discussion started by: ranvijaidba
2 Replies

10. Shell Programming and Scripting

How to embed data instead of reading user input from an array?

Hello, I am running under ubuntu1 14.04 and I have a script which is sending given process names to vanish so that I'd see less output when I run most popular tools like top etc in terminal window. In usual method it works. Whenever I restart the system, I have to enter the same data from... (2 Replies)
Discussion started by: baris35
2 Replies
VERIEXEC(9)						   BSD Kernel Developer's Manual					       VERIEXEC(9)

NAME
veriexec -- in-kernel file integrity subsystem KPI SYNOPSIS
#include <sys/verified_exec.h> void veriexec_init(void); bool veriexec_lookup(struct vnode *vp); int veriexec_verify(struct lwp *l, struct vnode *vp, const u_char *name, int flag, bool *found); void veriexec_purge(struct vnode *vp); int veriexec_fpops_add(const char *fp_type, size_t hash_len, size_t ctx_size, veriexec_fpop_init_t init, veriexec_fpop_update_t update, veriexec_fpop_final_t final); int veriexec_file_add(struct lwp *l, prop_dictionary_t dict); int veriexec_file_delete(struct lwp *l, struct vnode *vp); int veriexec_table_delete(struct lwp *l, struct mount *mp); int veriexec_flush(struct lwp *l); int veriexec_openchk(struct lwp *l, struct vnode *vp, const char *path, int fmode); int veriexec_renamechk(struct lwp *l, struct vnode *fromvp, const char *fromname, struct vnode *tovp, const char *toname); int veriexec_removechk(struct lwp *l, struct vnode *vp, const char *name); int veriexec_unmountchk(struct mount *mp); int veriexec_convert(struct vnode *vp, prop_dictionary_t rdict); int veriexec_dump(struct lwp *l, prop_array_t rarray); DESCRIPTION
veriexec is the KPI for Veriexec, the NetBSD in-kernel file integrity subsystem. It is responsible for managing the supported hashing algo- rithms, fingerprint calculation and comparison, file monitoring tables, and relevant hooks to enforce the Veriexec policy. FUNCTIONS
Core Routines veriexec_init(void) Initialize the Veriexec subsystem. Called only once during system startup. veriexec_lookup(vp) Check if vp is monitored by Veriexec. Returns true if it is, or false otherwise. veriexec_verify(l, vp, name, flag, found) Verifies the digital fingerprint of vp. name is the filename, and flag is the access flag. The access flag can be one of: VERIEXEC_DIRECT The file was executed directly via execve(2). VERIEXEC_INDIRECT The file was executed indirectly, either as an interpreter for a script or mapped to an executable memory region. VERIEXEC_FILE The file was opened for reading/writing. l is the LWP for the request context. An optional argument, found, is a pointer to a boolean indicating whether an entry for the file was found in the Veriexec tables. veriexec_purge(vp) Purge the file entry for vp. This invalidates the fingerprint so it will be evaluated next time the file is accessed. Fingerprint Related Routines veriexec_fpops_add(fp_type, hash_len, ctx_size, init, update, final) Add support for fingerprinting algorithm fp_type with binary hash length hash_len and calculation context size ctx_size to Veriexec. init, update, and final are the routines used to initialize, update, and finalize a calculation context. Table Management Routines veriexec_file_add(l, dict) Add a Veriexec entry for the file described by dict. dict is expected to have the following: Name Type Purpose file string filename entry-type uint8 entry type flags (see veriexec(4)) fp-type string fingerprint hashing algorithm fp data the fingerprint veriexec_file_delete(l, vp) Remove Veriexec entry for vp. veriexec_table_delete(l, mp) Remove Veriexec table for mount-point mp. veriexec_flush(l) Delete all Veriexec tables. Hook Handlers veriexec_openchk(l, vp, path, fmode) Called when a file is opened. l is the LWP opening the file, vp is a vnode for the file being opened as returned from namei(9). If NULL, the file is being cre- ated. path is the pathname for the file (not necessarily a full path), and fmode are the mode bits with which the file was opened. veriexec_renamechk(l, fromvp, fromname, tovp, toname) Called when a file is renamed. fromvp and fromname are the vnode and filename of the file being renamed. tovp and toname are the vnode and filename of the target file. l is the LWP renaming the file. Depending on the strict level, veriexec will either track changes appropriately or prevent the rename. veriexec_removechk(l, vp, name) Called when a file is removed. vp is the vnode of the file being removed, and name is the filename. l is the LWP removing the file, Depending on the strict level, veriexec will either clean-up after the file or prevent its removal. veriexec_unmountchk(mp) Checks if the current strict level allows mp to be unmounted. Miscellaneous Routines veriexec_convert(vp, rdict) Convert Veriexec entry for vp to human-readable proplib(3) dictionary, rdict, with the following elements: Name Type Purpose entry-type uint8 entry type flags (see veriexec(4)) status uint8 entry status (see below) fp-type string fingerprint hashing algorithm fp data the fingerprint The ``status'' can be one of the following: Status Meaning FINGERPRINT_NOTEVAL not evaluated FINGERPRINT_VALID fingerprint match FINGERPRINT_MISMATCH fingerprint mismatch If no entry was found, ENOENT is returned. Otherwise, zero. veriexec_dump(l, rarray) Fill rarray with entries for all files monitored by Veriexec that have a filename associated with them. Each element in rarray is a dictionary with the same elements as filled by veriexec_convert(), with an additional field, ``file'', containing the filename. FILES
Path Purpose src/sys/dev/verified_exec.c driver for userland communication src/sys/sys/verified_exec.h shared (userland/kernel) header file src/sys/kern/kern_verifiedexec.c subsystem code src/sys/kern/vfs_syscalls.c rename, remove, and unmount policies src/sys/kern/vfs_vnops.c regular file access policy SEE ALSO
proplib(3), sysctl(3), veriexec(4), security(7), sysctl(8), veriexecctl(8), veriexecgen(8), fileassoc(9) AUTHORS
Brett Lymn <blymn@NetBSD.org> Elad Efrat <elad@NetBSD.org> CAVEATS
There are two known issues with Veriexec that should be considered when using it. Remote File-systems There is an issue providing protection for files residing on mounts from remote hosts. Because access to the file-system does not necessar- ily go through veriexec, there is no way to track on-disk changes. While it is possible to minimize the effect by evaluating the file's fin- gerprint on each access without caching the result, a problem arises when a file is overwritten after its fingerprint has been evaluated and it is running on the local host. An attacker could potentially overwrite the file contents in the remote host at that point, and force a flush on the local host, resulting in paging in of the files from the disk, introducing malicious code into a supposedly safe address space. There is a fix for this issue, however due to dependencies on other work that is still in progress it has not been committed yet. Layered File-systems Due to VFS limitations, veriexec cannot track the same on-disk file across multiple layers of overlay file-systems. Therefore, you cannot expect changes to files on overlay mounts will be detected simply because the underlying mount is monitored by veriexec. A workaround for this issue is listing all files, under all mounts, you want monitored in the signature file. BSD
March 18, 2011 BSD
All times are GMT -4. The time now is 03:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy