Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [shell]

A shell is software that lets users interact with the operating system, usually by typing at a command-line.

0
votes
1answer
26 views

win - python 2.7 & 3.6 - switching version that script uses from shell

I have placed a script test.py in my %USERPROFILE% folder: import sys print("TEST", sys.version_info, sys.executable) When running cmd (WIN+R) and then typing test+ENTER the following is returned: ...
0
votes
1answer
16 views

Archiving only the deepest subfolders

I have a very nested directory structure where only in the deepest folders are files. There folders I want to archive via shell with ZIP or RAR but not the parent folders. | Directory |-----...
1
vote
1answer
35 views

How to handle a .js extension correctly in bash script?

I have the following bash script. while IFS= read -r filename; do [[ $(md5 path/to/"$filename-orig") = $(md5 path/to/"$filename") ]] || echo $filename differs; done < path/to/list-of-files-to-...
-1
votes
0answers
29 views

How to set default app for some file type in windows 10

I want to set an node.js C:\Program Files\nodejs\node.exe handler as a default action for opening .js files in Windows 10. So that "when i left-click them i can run them". However when i right click ...
0
votes
1answer
37 views

How to remotely terminate bash shell processes but ensure history is saved?

Occasionally my X11 window manager (i3) locks up, and I'm forced to switch to a Linux virtual console, or SSH into my machine, to regain control. Usually this happens when I have numerous rxvt ...
0
votes
1answer
28 views

VIM - running a shell command fails within a macro

I have a list of items in a file, and I am trying to add an id on the line before each one. The id is generated by an external shell command and added to the buffer: :r !php _setup/getid/php item | ...
-1
votes
1answer
46 views

UDP client through terminal [closed]

i'm trying to connect to a udp server on the same machine the code of both server and client works fine !! but when i run the server program i have to run the client on the terminal or shell in order ...
2
votes
2answers
419 views

Capture specific environment variable from Linux sub-shell

I am trying to figure out a way to run a shell script B from script A, set or export a variable in script B, and be able to store that value in script A after script B finishes and its sub-shell ...
0
votes
5answers
105 views

Can't cd into directory with space in its name, even with quotes or escaping

In a bash shell on a MacOS machine, I can see by typing ls that there is a director Application Support: $ ls Accounts FontCollections PreferencePanes Application Scripts Fonts ...
-1
votes
1answer
28 views

Automatically mount on fstab

I have a system.bin whici is located in /mnt and i want to automatically mount by edtiting fstab on /mnt/mymount with read and write permissions for all users on system i try adding this on fstab: ...
1
vote
1answer
72 views

what is bash command `command` used for and what is it when it appears in shell script

when I was writing a shell script, I happen to know command is a reserved word. Then I noticed command is also a bash command. command ls gives the same result as ls. command ls | grep xxx gives the ...
2
votes
1answer
43 views

Files created in Cygwin have corrupt Windows security settings

On one Windows 10 PC, when I create a file from a Cygwin bash shell, the Windows security settings for the file are corrupted. So, for example, if I type echo test > test.txt, when I bring up the “...
0
votes
1answer
29 views

How to sort an ls-like file list?

How do I sort by the last column a list which looks like this: drwxr-sr-x 2 user group 4096 2018-02-19 14:11:42 /something/project/somefile drwxr-sr-x 2 user group ...
0
votes
1answer
60 views

How to reorder folders in a directory in Linux?

I am new to Linux and am supposed to write a shell script to reorder the folders in a directory on the basis of ctime. The place where i am stuck is sorting the folders physically. I have tried the ...
0
votes
3answers
77 views

database copy shell script including password with special characters

I am trying to create a shell script for a mysqldump (and mysql) operation where the password is stored directly in the script. The password contains special characters which need to be handled ...
0
votes
2answers
65 views

Is it possible to run a C-File using an ARM CPU emulator?

I had the idea of emulating an ARM CPU to run different programs. To begin with, I wanted emulate the CPU and run for example a simple "hello world" written in C. Sadly I found no answer using Google ...
0
votes
0answers
17 views

how to copy public key using ssh-copy-id silently

I am copying my public key to another machine using ssh-copy-id. $ sudo ssh-copy-id -i /home/vagrant/.ssh/id_rsa.pub vagrant@datanode1.com /bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/...
0
votes
0answers
11 views

update value of PasswordAuthentication property as yes in /etc/ssh/sshd_config silently

I want to update /etc/ssh/sshd_config file with PasswordAuthentication as yes. I am able to do it using vi editor. is it possible to do the same silently with unix command.
-2
votes
1answer
64 views

gzip command is not working in shell script [closed]

If I run my script through crontab, gzip is not working fine. If I run the same script manually gzip is working. The command we have in our script is gzip -vf $path/file.eee In my script I am ...
0
votes
1answer
77 views

What is the recommended way of managing environment variables in Unix systems? [closed]

I have always been thinking about the effective way of managing environment variables in operating systems like Ubuntu, macOS, etc.. I have a couple of questions related to it. Is there a common ...
0
votes
0answers
90 views

Shell not running or DBus service not available

I am using a Linux Mint 19 Tara and I installed the gnome-tweaks-tool and when I tried to open it with gnome-tweaks I encountered the following error: WARNING : Shell not installed or running ...
0
votes
2answers
60 views

Sets in Windows 10 (Insider Preview)

I am looking for the tool or utility that is used in the below screenshot. It seems to be an laternative to ConEmu, but it is not the same. Does anybody knows what is the tool name? ** Please note ...
0
votes
2answers
39 views

Splitting the Output of two commands in Shell script

I am using command like timeout 10 ping 8.8.8.8 | tail -2. Here I am getting output as Terminated. But I need the last two lines of ping. Can any one please tell what to do
0
votes
0answers
18 views

How to rebase a branch from previous fork in one command?

So I'm trying to come up with a ZSH alias for Git that will rebase my current branch onto the branch it was originally derived (forked) from. Examples: Given the following branch names of A and B. ...
0
votes
1answer
106 views

grep command fails on one Windows PC, but works on other Windows PC w/ same configuration

I want to issue a logcat command to filter logs specifying a keyword (say apk). But I am facing an issue where the grep command is not recognized on one of my windows 7 PC. The same command works ...
0
votes
3answers
57 views

How to record stdout and stderr with different tags in syslog?

I can redirect both stdout and stderr to logger this way: ./myprog 2>&1 | tee /dev/tty | logger but I would like to be able to tag each log entry with "myprog-out" and "myprog-err" based on ...
0
votes
1answer
105 views

Bash script need to convert string to date

Hello I have this bash script for checking the integrity of backups. I need to edit it as I have to make warn me when the oldest backup is more than 60 days (as we delete those). Now the date is ...
0
votes
1answer
42 views

How to check for return statuses of piped commands in ash shell?

How to check for the return codes for processes piped to each other in ash shell? Here is the command I am interested in: dd if=/my/block/device | ssh myuser@otherserver "gzip > file.gz" Also, ...
1
vote
1answer
67 views

Interactive, non interactive shells and expansion

If I execute the test [[ ! (-z "") ]] interactively, or non interactively by bash -c '[[ ! (-z "") ]]', I obtain the same result, that is echo $? gives me 1. But if I forget a space in the above ...
0
votes
1answer
27 views

Automate a process using bash script

I have a unimrcp client process (ucp) and I want to spawn multiple ucp using shell script. Whenever I spawn a ucp, it returns a command line using which I can access different functionalities in ucp. ...
0
votes
2answers
30 views

How do I prevent a leading newline in Vim when using :r!date and other shell commands?

Most of the time when I'm inserting a date, I'm trying to do it in the middle of a line. By default, it looks like the :r! flavor of insertion always puts the result on a new line. This makes some ...
0
votes
1answer
24 views

Run multiple jar files sequentially (not simultaneously) using shell script and docker

I have 2 jar files say abc.jar and xyz.jar , I want to run them sequentially one after another. when my start.sh is like this /usr/lib/jvm/java-8-openjdk-amd64/bin/java -jar abc.jar & /usr/lib/...
0
votes
2answers
54 views

How to give script read access to files in a directory on Linux

I created a shell script that deletes duplicates in a given directory. It prints “access denied” followed by file name if a certain file cannot be read. When I try to run ./filename (name of the shell ...
1
vote
1answer
62 views

shell how to inhibit ssh yes or no input for Are you sure you want to continue connecting

In a shell script, it ssh to a server cluster, which includes dozens of servers. But some new servers do not run commands properly. I believe it is ssh yes or no problem. So I would like to have ssh ...
2
votes
3answers
227 views

Using bash to export a comma separated list to html

I've got a cxomma-separated csv that I want to turn into custom html, and I ran into another script which did it, but it's been nothing but issues for me since I use https://www.tutorialspoint.com/...
0
votes
0answers
31 views

ssh does not quit even after remote host reboots

I am using a command of the form: dd if=/my/block/device | ssh myuser@otherserver "gzip > file.gz" in my script. The block device being copied is very large (17GB). In many cases, I see that even if ...
0
votes
1answer
61 views

How to repeat a character N times with printf

I have a function that a pass a string. I want this function to pad this string with * in a line. Lets say I pass foo bar I want it to print something like *************** *** foo bar *** ************...
0
votes
1answer
15 views

Shell script zips a folder, but exclude parameters not working IF its run from cron.daily

The script works fine if I run it with sh filename, but it ignores all the --exclude parameters if its run by cron: #!/bin/sh TIMESTAMP=$(date +%u) WEEK=`date +"%V"` if [ $(($WEEK%2)) -eq 0 ]; then ...
0
votes
1answer
49 views

How to find and tar files then delete them

I need to find files that are older than 30 days, tar and compress them and remove the ones that I already tar and compressed. I was trying to execute something like this but it does not look like ...
0
votes
1answer
33 views

Pipeline after sourcing a bashscript

I have a code # Inside Child.sh ChildVariable=BigChild # Inside Parent.sh source ./Child.sh echo "ChildVariable=${ChildVariable}" Output: ChildVariable=BigChild But, # Inside Parent.sh source ....
0
votes
0answers
24 views

Fast navigation in Midnight Commander Shell link mode

Is it possible to achieve the same behavior as on the local machine with Ctrl+O allowing navigating directly in shell, when connected to SSH server (Left / Right -> Shell link...)? Or is there any ...
0
votes
1answer
36 views

how unzip many zip files found in many subdirectories, all in a certain different directory

i have a list of zip files, which each zip file in it has also some other zip files, and so on. I need to extract them all, with an ubuntu shell command, and get only the files with the extension *....
0
votes
1answer
33 views

Usage of the percentile operator in shell scripts

In this link: https://superuser.com/a/180252/401901 The following command is used: cat list.txt | xargs -I % echo cp % new_folder What does the % % usage mean? All google search results are about ...
0
votes
0answers
38 views

Need Power shell command to get update list

Need a power shell command by which I can extract all updates list installed for Microsoft application. Note: only updates installed for application, not windows updates list. which can get by hotfix. ...
0
votes
0answers
67 views

Fish shell not clearing history completely when starting

EDIT: I figured out what went wrong! The root cause of it was my .bash_history file; that contained the commands! I've configured my fish shell to clear my fish history (because of personal ...
0
votes
1answer
19 views

The $1.gz exists in the folder, but it said cannot access, no such file or directory

I have a script that says gzip -cN "$1" > "$1.gz" | ls -l "$1.gz" | awk '{print $5}' I run it with an argument of ff, and I get the error message ls: cannot access ff.gz: No such file or ...
1
vote
1answer
24 views

Setup different path for fish shell temporally

User libraries are normally in /usr/local/lib. However I want to build some third party libraries in for example /Users/user/Public/lib. I only want to do it during my testing. Is there a elegant way ...
1
vote
2answers
49 views

Is it possible to use zsh in windows machines?

Is it possible to use zsh shell in windows along with console 2. If possible how can I install and configure it.
-5
votes
2answers
130 views

what does this bat file do?

I found a file with the following content that was on the flash: File What coding does it use? How to decode it?
0
votes
2answers
104 views

Loop and extract files matching a path

I am currently in a directory with many directories. $ ls the bad icons 100 the games icons 100 the beach & camping icons 100 the halloween icons 100 How can I extract ...