Newest 'shell' Questions - Stack Overflow

Questions tagged [shell]

The term 'shell' refers to a general class of text-based interactive command interpreters most often associated with the Unix & Linux operating systems. For questions about shell scripting, please use a more specific tag such as 'bash', 'powershell' or 'ksh'. Without a specific tag, a portable (POSIX-compliant) solution should be assumed, though using 'posix' in addition or 'sh' instead is preferable.

0
votes
0answers
13 views

How to get the most six cpu and memory consuming processes

Im trying to get the most six cpu and memory consuming processes. It is the first time that I'm trying to write a script in bash. I need to get the exact output, but I can't find out what I need to ...
0
votes
1answer
10 views

Python subprocess and filepaths with parentheses or spaces [Windows or Linux]

I had a problem with calling a python 2.7 script with subprocess module methods in a Debian linux WM. The file path had parentheses and spaces in it, and even using various methods described here (...
0
votes
0answers
14 views

get Second line from the output

the output contains n number of lines, specifically I want to get only the second line. but when I use "awk 'NR==2' command it is only giving the first line not the second line when I type " show ...
0
votes
0answers
6 views

Combine and reformat 2 files into a new files

I'm collection some of the output of the command and want to combine 2 output files into a new file. Output sample output1.txt OBJECTNAME(TEST.OBJ.1) TYPE(LOCAL) MESSAGE(20) OBJECTNAME(TEST.OBJ.2) ...
0
votes
2answers
26 views

Bash selection menu based on command output

How can I make a selection menu based on other command output? For example running following command: kubectl config get-contexts I am getting following output: CURRENT NAME CLUSTER ...
0
votes
2answers
24 views

Executing a native File from init.rc in Android

I want to execute a file from vendor/bin from my init.rc. Below code I have added to my init.rc file on property:sys.vendor.Test_callback=1 exec - system system -- /vendor/bin/testBinary setprop sys....
-2
votes
1answer
26 views

Listout file created on sunday using shell script

**I have files in my directory. Files name is as below. Backup-2018-07-29.tar.gz Backup-2018-07-30.tar.gz Backup-2018-08-05.tar.gz Backup-2018-08-06.tar.gz Connectly-2018-08-05-05.tar.gz meraBoxDump-...
0
votes
0answers
6 views

Executing shell script in windows

How to execute shell script in Windows and send an attachment of the script output to the outlook mail? I'm banging my head from the last 2 days to work on this.
1
vote
6answers
31 views

shell scripting “test ” command

I m writing shell program to compare two numbers and show the status using test command #!/bin/sh a="42" b="23" echo $a test [$a -eq $b] echo $? but I m getting error like this eq: line 5: test: [...
-1
votes
0answers
12 views

PySpark 2.2 UDF (User Defined Function) not working in interactive shell

PySpark 2.2 UDF (user defined function) not working in interactive shell I made predictions using a trained random forest classifier in pyspark 2.2 and I have a dataframe with customer ID and a ...
-1
votes
1answer
41 views

How to automatically send “yes” to ssh prompt in shell script?

This is the line in my shell script (runs on Azure cli) which asks for "yes/no". How do I automatically give an input? ssh $adminUser@$serverIp'./new_script.sh' $paramOne $paramTwo The server I am ...
0
votes
0answers
11 views

Is there a repository of scripts to install of language runtimes (python, golang, node) and binaries (docker, imagemagick)? [on hold]

I am spinning up many different servers for very different use cases, and I need a mix of all common run-times. For example, I want to install Golang 1.8 and Node 8.6 and .NET Core 2.1 on Ubuntu 18.04,...
0
votes
0answers
7 views

Unable to execute after chmod/chown

lsd This is just ls and it shows I already have permissions. chmod +x start.zsh The command for execute permissions chown "${whoami}" start.zsh The command to own the file (shouldn't be necessary)...
0
votes
0answers
22 views

How to fix c 'cannot open file xxx' error by including corresponding files?

I'm running a shell script on a board. The shell command looks like: ./gmx mdrun -notunepme The error is: source code file /home/../gmxfio.c cannot open file: topol.tpr This gmxfio.c file is not ...
0
votes
0answers
10 views

Shell: If..elif condition is not working to create files as required [duplicate]

I am learning shell scripting and have a following requirement: Req.: Need to collect the grades from a students grade file and create files having respective grades in it. Sample file: ...
-1
votes
2answers
35 views

Powershell Replacing CMD

How can PowerShell replace CMD when, as a default, execution policy is restricted (which is for a good reason though), but, for example, with many commercial software systems around that require batch ...
1
vote
2answers
38 views

How can I capture a result about a SQL query and put into a variable using <<EOF in bash? [duplicate]

I need create a linux script and in this script I need capture the result of the SQL query in Oracle and put into a variable for example: sqlplus -s /nolog<<EOF conn c##myuser/mypassowd col ...
0
votes
1answer
25 views

Should there be duplicate information in my path on my mac?

I used this command multiple times export PATH=“/usr/local/opt/mysql@5.7/bin:$PATH” Now it seems this caused me to have duplicate information in my $PATH. echo $PATH “/usr/local/opt/mysql@5.7/bin:...
-1
votes
0answers
32 views

How do I start from the nth line number, find the nth occurrence of a pattern and that occurrence's line number?

I know that I can find the line number of the nth occurrence of a pattern using the awk command but I'm not sure how to start it from a specific line number. For example: Starting at the 2nd line how ...
1
vote
2answers
29 views

Shell in VBA. Am I missing something to make Shell work in a different access database

I have been scratching my head on this one. Usually I find the answer due to some stupid syntax or missing space, but this one is baffling me I have used the "Shell" function before in other access ...
0
votes
0answers
18 views

bash shell script to subtract milliseconds from a given timestamp

I have a bash shell script where I take an inputDate string and then add some months to it to get a new date and then I format it as timestamp with milliseconds as below START=2017_01_01; i=1; ...
0
votes
0answers
21 views

Search for Files and Create a Number of Copies

Very new to coding... bare with me. I am using Cygwin, and I am trying to write a function that takes in two arguments, a file name, and an integer. I would like the function to search through ...
0
votes
0answers
31 views

How to write a bash script to set up working environment?

I want to write a bash automation script to set up my working environment. Like every day I need to open 7 tabs of the terminal with each service running different command and I also open eclipse and ...
0
votes
1answer
14 views

Connecting a db that is several levels under ssh

In order to reach the Cassandra I have to enter: ssh dev@001.company.net Then: ssh dev@another-one.company.net Then again: ssh dev-test-001.company.net I am trying to connect a Hackolade ...
0
votes
0answers
20 views

Bash Script. Enter Username and Password

I'm trying to write a script that calls another one. Then it should fill in username and password. Unfortunately spawn does not call my script file. I created both scripts and then created them with ...
0
votes
3answers
27 views

How to find a similar file to a given file into a directory with returned value of diff command?

I am looking for a way to find (one)/(multiple) files that (is)are identical to a given file. I would like to perform this with bash shell using the commands findand diff I have tried the following ...
0
votes
0answers
20 views

mapfile command giving me syntax issues [duplicate]

Trying to compare two arrays and print the differences, and getting below error. 1.sh: line 9: syntax error near unexpected token `<' 1.sh: line 9: ` mapfile -t $1 < <(comm -23 <(echo "${...
1
vote
0answers
8 views

Failing in Install Anaconda in C-shell

My shell is C shell, I cannot initial and activate conda environment, The following is what happens when I run conda activate: CommandNotFoundError: Your shell has not been properly configured to use ...
0
votes
0answers
32 views

Why does sequentially labelling files in folder creates extra files?

Currently trying to preprocess data and need to name all the image files in my folder sequentially, however when I try to do it with the code below, it ends up producing more files that appear to be ...
0
votes
0answers
14 views

How to use lxc exc to issue multiple commands as specific user

My goal is to execute two commands in a specific folder as ubuntu from outside of it's lxc container. I've tried a couple of things but I figured this example is the closest I have to working. If I ...
0
votes
0answers
18 views

How to convert .bat script to Shell script [on hold]

I am trying to access windows servers to excute .bat from linux server. cd C:\MDMBatch psexec \\10.16.65.85 -u echristus\va.informatica -p Password1$$ cmd /c "C:\infamdm\hub\MDMExecuteBatch\scripts\...
0
votes
0answers
15 views

How to loop a sound with Sox?

I want to loop a sound with Sox, but I haven't seen any option to loop in the Sox Man. I tried to do an alias like this: function lplay { while (true) do play -v0.15 ~/'$1'; done } alias lplay ~/'$1'...
-1
votes
2answers
33 views

Shell Script for Delete all files in directory and print count of deleted files

I want to delete all files in directory and print count of deleted files using shell script. this is my shell script to Delete All files #!/bin/sh rm -rf /Directory/SubDirectory/* I tried this ...
1
vote
1answer
18 views

shell script has been retrieving from edbplus sql results with echo outputs

I am trying to call edbplus to count a table from a command-line linux shell script, but I have been retrieving from edbplus the response number with others outputs in the same response, I am trying ...
-1
votes
2answers
17 views

jq display different fields of a json file

I want to get different values from a json file with jq but i can't get values which are in a different level. Here is the json i have : { "id": 132, "status": "succeeded", "project": "TEST-...
-1
votes
0answers
9 views

Garbage collection from shell script

I have created a script which invokes garbage collection from unix terminal using jstat and jcmd. The process is running via root and the script is also owned and executed by root user /usr/java/...
-3
votes
0answers
16 views

Run multiple commands sequentially in the same command box with Visual Basic

My teacher has given me the task to solve the following problem, but I have no idea how to do it. I shall execute several commands in the command box one after the other. My only tools here are the ...
-2
votes
1answer
27 views

Why are globs in the shell read command expanded? [duplicate]

I am using linux shell command read to read the only line from a file which contains a path to files with glob *. When I output the line, I did not get the original line but the content with all the ...
1
vote
1answer
37 views

How do i fix this .bat file so it can run in macOS?

I have this .bat file created and working perfectly in Windows. When I tried to run this file from macOS terminal, it shows some error. I've already had JRE installed in my Mac. I also added: ...
0
votes
0answers
17 views

How to escape a “su -c 'psql … -c \”\“' ” with reserved words

The reserved word 'user' is the problem for me, because it should be escaped with "" (double quotes) but with the combination of different quotes (' and " and \' and "/) psql passes it as user (...
0
votes
1answer
20 views

Shell script error: Syntax error: “(” unexpected (expecting “fi”)

I am getting a syntax error with the following shell script and I just can't figure out why: ./query_certs.sh: 22: ./query_certs.sh: Syntax error: "(" unexpected (expecting "fi") Is it because of ...
1
vote
0answers
30 views

How to pass shell script calling command to a log file?

I have a Linux shell script (test_script) that receives arguments, that are later interpreted by the same shell script and assigns the incoming arguments to some parameters. Now, is there a way to ...
2
votes
0answers
21 views

return value of ((a++)) in shell

I got an unexpected behavior of a shell script. Finally I found that the error is caused by the return code of ((a++)). but I don't know why. The simplified script is as followed: set -e a=0 ((a++)) ...
0
votes
0answers
7 views

How to recover stack size after execute`ulimit -s 0`?

root@9b096d3152e8:~# ulimit -s 0 root@9b096d3152e8:~# ulimit -s 8192 bash: ulimit: stack size: cannot modify limit: Operation not permitted root@9b096d3152e8:~# ls -l Segmentation fault (core ...
0
votes
0answers
19 views

Current code marking REGEX as invalid even though it is valid via REGEX checkers [duplicate]

I am trying to validate a date which is in the form dd-mmmm-yy e.g. 01-Jun-19 in a shell script. I have the pattern which I have checked in online regex checker, the pattern is ^(([0-9])|([0-2][0-9]...
1
vote
1answer
17 views

how to import variable from another shell script?

i have to write a bash script wherein i need to connect with oracle database and perform some queries. `sqlplus $DB_USER/$DB_PASSWORD' These variables are stored in another file "rangerenv.sh" How ...
0
votes
1answer
21 views

shell script is unable to create workspace in eclipse che

i have written a shell script to create a workspace in eclipse che. the script is generating the workspace url. but when i open it, workspace does not exit. Am i missing on something? #!/bin/sh #=====...
0
votes
0answers
6 views

subprocess.Popen does not work as expected when execute shell command [duplicate]

subprocess.Popen does not work as expected when run shell command. python version 2.7.X, os is CentOS Linux release 7.4.1708 (Core). import subprocess import shlex command = "ls -lh compute.py | ...
2
votes
3answers
71 views

Is there any way to convert paragraphs to columns in shell script to format it in Excel?

We have a requirement to format data, given in list format, into a CSV file Example input: ORG MANAGER No ORG MANAGER found BILLING MANAGER No BILLING MANAGER found ORG AUDITOR xxx yyy zzz ...
0
votes
0answers
20 views

Permission Denied when executing liquibase command in Jenkins

I'm getting this permission denied error when I'm trying to execute a liquibase command as a shell command. /tmp/jenkins976.sh: line 3: /home/ec2-user/liquibase/liquibase: Permission denied I've ...