Sponsored Content
Top Forums Shell Programming and Scripting Using commands within bash script Post 303022012 by annacreek on Wednesday 22nd of August 2018 10:41:19 PM
Old 08-22-2018
I am sorry, that is not what I asked for.
Maybe this will clarify my request.

Here is a sample of one of the command outputs currently send to terminal and to get back to my script I have to use keyboard and type "q".
I would like to "automate" this outwit user interaction.




Code:
pi
    State: degraded
     Jobs: 0 queued
   Failed: 2 units
    Since: Thu 1970-01-01 00:00:01 UTC; 48 years 7 months ago
   CGroup: /
           |-user.slice
           | `-user-1000.slice
           |   |-user@1000.service
           |   | |-gvfs-gphoto2-volume-monitor.service
           |   | | `-808 /usr/lib/gvfs/gvfs-gphoto2-volume-monitor
           |   | |-dbus.service
           |   | | `-669 /usr/bin/dbus-daemon --session --address=systemd: --nof
           |   | |-gvfs-udisks2-volume-monitor.service
           |   | | `-789 /usr/lib/gvfs/gvfs-udisks2-volume-monitor
           |   | |-gvfs-mtp-volume-monitor.service
           |   | | `-828 /usr/lib/gvfs/gvfs-mtp-volume-monitor
           |   | |-gvfs-goa-volume-monitor.service
           |   | | `-824 /usr/lib/gvfs/gvfs-goa-volume-monitor
           |   | |-gvfs-afc-volume-monitor.service
           |   | | `-803 /usr/lib/gvfs/gvfs-afc-volume-monitor
           |   | |-init.scope
           |   | | |-652 /lib/systemd/systemd --user
lines 1-23


I am currently trying to redirect the command output back to my scrip and maybe I won't need this keyboard interaction.

------ Post updated at 09:41 PM ------

Here is the solution , outputs the entire file to "script window ", text can be scrolled and the display can be terminated using standard "buttons"



Code:
inputBox(){
  37  HOSTNAME=$(\
  38  whiptail \
  39  --scrolltext \
  40  --title "Test input /text box " \
  41  --textbox /dev/stdin 20 80 <<<$($choice) \
  42 3>&1 1>&2 2>&3)
  43  
  44 }


Last edited by MadeInGermany; 08-23-2018 at 03:44 AM.. Reason: Corrected code tag
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Can BASH execute commands on a remote server when the commands are embedded in shell

I want to log into a remote server transfer over a new config and then backup the existing config, replace with the new config. I am not sure if I can do this with BASH scripting. I have set up password less login by adding my public key to authorized_keys file, it works. I am a little... (1 Reply)
Discussion started by: bash_in_my_head
1 Replies

2. Shell Programming and Scripting

Execute commands from script in current bash session

I have a file as follows: cat /etc/mxg/ssh-hostsmx.example1.com.au:2225 mx2.example2.com.au:2225 mx.example3.com.au:2225 mail.example4.com.au:2225 mail.example5.org.au:2225 mail.example6.com.au:2225I want to dynamically create aliases for quick access to these servers from bash. I wrote... (4 Replies)
Discussion started by: jelloir
4 Replies

3. Shell Programming and Scripting

how to run non-standard commands in bash script?

Hello All. I suspect that this will be a clear noob question, but I haven't been able to figure it out using the usual methods, so I turn to you. I've written a script to create input files for the quantum chemistry program NWCHEM. Generally you create an input file and then execute it by... (12 Replies)
Discussion started by: EinsteinMcfly
12 Replies

4. Shell Programming and Scripting

Execute ssh commands through bash script

Hi all! I am trying to write a script that will check if a certain directory is available at several different nodes and then do stuff in it ..... On the beginning of the script I give as a variable the directory and the number of the nodes and then I loop like this: for... (3 Replies)
Discussion started by: idet2
3 Replies

5. Shell Programming and Scripting

Suppressing the terminated message from pkill & killall commands in a bash script

Hi all, I've been pulling my hair out with this problem for 3 days:wall: now without success any help would be massively appreciated. Basically the script is used to shutdown a rails server so a new IP address can be assigned, the shutdown part is taken care of in function_one using the... (2 Replies)
Discussion started by: danmc
2 Replies

6. Shell Programming and Scripting

How to combine awk and bash commands in script ?

Dear friends, I am just trying write one script using 2 files one file will contain details like below #X SERVER X LOCATION URL="http://www.abcd.com" FILENAME="abc.txt" ID_NAME="myabc_xyz" SERVER_PATH="/usr/local/dummy/html/....." #Y SERVER Y LOCATION URL="http://www.xyz.com"... (10 Replies)
Discussion started by: Akshay Hegde
10 Replies

7. Shell Programming and Scripting

Combine several commands in a bash script

Hi all, I have large files with url-s ending on "|<number>" which is the Page Rank for the website as shown in the example below http://www.machinokairo.com/2012/05/post-39.html|2 I am using "grep" to sort out all url-s in a particular way: first, remove all ending on "|0" and write the... (9 Replies)
Discussion started by: georgi58
9 Replies

8. Shell Programming and Scripting

Why commands inside bash script lost effectiveness?

Hi, I have a bash script to run many system commands on CentOS machine, but I am puzzled by some commands had no effect on parent environment. For example, I want to refresh the desktop xdg menu when some processes added or deleted items from desktop xdg menu. If I run "killall gnome-panel"... (4 Replies)
Discussion started by: hce
4 Replies

9. Shell Programming and Scripting

How to create an executable bash script for these commands?

I wish to create an executable bash script that will run the following commands as root, that is, using sudo su iptables-save | awk '/^ / { print $1 } /^:+ / { print $1 " ACCEPT" ; } /COMMIT/ { print $0; }' | iptables-restoreMy first attempt at bash... (9 Replies)
Discussion started by: thixeqi
9 Replies

10. Shell Programming and Scripting

How to run several bash commands put in bash command line?

How to run several bash commands put in bash command line without needing and requiring a script file. Because I'm actually a windows guy and new here so for illustration is sort of : $ bash "echo ${PATH} & echo have a nice day!" will do output, for example:... (4 Replies)
Discussion started by: abdulbadii
4 Replies
gvfs-move(1)							   User Commands						      gvfs-move(1)

NAME
gvfs-move - move a file from one VFS location to another SYNOPSIS
gvfs-move source-URI destination-URI DESCRIPTION
gvfs-move moves a file from one URI location to another, using the virtual file system. OPERANDS
The following operands are supported: source-URI Specifies the source file location in standard URI format. destination-URI Specifies the destination file or directory location in standard URI format. EXAMPLES
Example 1: Moving a File From a Web Server to a Local File example% gvfs-move http://www.sun.com file:///home/user/index.html ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables: NLSPATH. EXIT STATUS
The exit value 0 is returned regardless of success or failure. FILES
The following files are used by this application: /usr/bin/gvfs-move Executable to move a file from one VFS location to another ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-gvfs | +-----------------------------+-----------------------------+ |Interface stability |Volatile | +-----------------------------+-----------------------------+ SEE ALSO
gvfs-cat(1), gvfs-copy(1), gvfs-rename(1), gvfs-info(1), gvfs-less(1), gvfs-ls(1), gvfs-mkdir(1) gvfs-monitor-dir(1), gvfs-monitor-file(1), gvfs-mount(1), gvfs-copy(1), gvfs-open(1), gvfs-rm(1), gvfs-save(1), gvfs-trash(1), gvfs-tree(1), attributes(5), environ(5) NOTES
Written by Alvaro Lopez Ortega, Sun Microsystems Inc., 2008. SunOS 5.11 25 Mar 2008 gvfs-move(1)
All times are GMT -4. The time now is 09:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy