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

learn more… | top users | synonyms

-1
votes
0answers
22 views

Can I wrote an script for Receive an sms and does something on linux os like ssh or restart the system?

I'm trying to write a script that when Receive an sms ,does some actions like ssh to other server or kill some processes ,... . it isn't important that it be shell script or php script .
0
votes
2answers
21 views

How to create linux user with only and only READ permission not EXECUTE and WRITE permission?

I have created user, e.g. ronly, now I want to give them read only access to few directories on other user home like abc/,xyz/,pqr/ so I put this ronly user in others means not created any group for ...
0
votes
0answers
16 views

Convert powerpoint to markdown

Can I convert powerpoint to markdown? My ultimate goal is to create an easily versionable version of the powerpoint. (Maybe reveal.js or something)
0
votes
2answers
14 views

Unescaped commandline content in fish shell

Is there a way to get the unescaped content of command line in fish? I mean if command line is like ... $ ls 'foo' "bar" ... the desired output would be ls 'foo' "bar". The commandline fish ...
1
vote
1answer
11 views

How to get piped output in color?

I am using FreeBSD with the csh shell. As an example, in the terminal / screen I get color output for ls (eg. ls -lGs). But when I pipe it through more (eg ls -lGs | more) the output has no colour. ...
1
vote
0answers
16 views

LibreOffice on OS X: running soffice keeps saying no Info.plist or no NSPrincipalClass in Info.plist

I'm trying to run LibreOffice 5.1.3 from the OS X terminal, to script some conversion tasks. However whenever I run soffice, I always get this error: No Info.plist file in application bundle or no ...
2
votes
1answer
25 views

How to set different shell prompt color for each newly opened terminal

I am using Ubuntu and can manually change the bash shell prompt color to green using export PS1="\e[0;32m[\u@\h \W]\$ \e[m" However, I want the shell prompt color to automatically change whenever I ...
0
votes
1answer
30 views

Why does terminal repeat “//: is a directory” after I source .bash_profile?

Sergios-MBP:~ home$ nano ~/.bash_profile Sergios-MBP:~ home$ source ~/.bash_profile -bash: //: is a directory -bash: //: is a directory -bash: //: is a directory -bash: //: is a directory -bash: //: ...
1
vote
1answer
27 views

How to use '!!' (double exclamation) in bash script?

This is the scenario: Sometimes I want to open a list of files using vim. That list of files is output of a command. So I can type vim $(!!) and open those files after running that command. Is it ...
-1
votes
0answers
17 views

Self-contained installer in korn shell script with sed, grep and gzip

There's a great post on this here: http://www.matteomattei.com/create-self-contained-installer-in-bash-that-extracts-archives-and-perform-actitions/ But is uses Bash interpreter, tar and awk. I need ...
1
vote
0answers
32 views

Get desktop shell access by wired connection from Raspberry Pi

Today I asked my self if this was possible: Connect a Raspberry Pi to a desktop PC (Ideally to the motherboard, so that the Pi can be hidden inside the case) and then connect he Pi the the Internet ...
1
vote
0answers
32 views

Matching a randomly generated integer with a specific place value in a string

In bash I want to prompt user for input in a script. Lets say the input is: #!/bin/bash echo "Please enter a number." read NUM # User enters "12345678" How can I use the next command to generate ...
3
votes
2answers
69 views

How to start a screen session from a shell script using crontab and then reattach to it?

I want to run the following shell script (launch.sh) to start/stop a screen session using crontab !/bin/bash cd ~/screen DATE_FORMAT=+%Y-%m-%d:%H:%M:%S echo --- START --- date $DATE_FORMAT if [ ...
1
vote
0answers
37 views

Purpose of function export in bash

If we take a look at the following example: # testing(){ echo hello;} # testing hello # echo $(testing) hello # echo testing >script # ./script ./script: line 1: testing: command not found # ...
1
vote
2answers
35 views

Source by bashrc when I exit an ssh session

I'm on OS X and using iTerm2 I've updated my bash profile on several of my servers so that when I ssh into them I can tell at a glance from the tabs what boxes I'm on. when I exit from an ssh ...
0
votes
0answers
24 views

issue launching atom via git bash shell

I am trying to launch atom from the git bash command line. Sometimes atom has some sort of an auto-update feature where it upgrades itself. And when that happens, you may notice something on the ...
0
votes
1answer
35 views

Changing my shell bash script default $PWD to it's (the script's) current location

Hey I'm running my shell script that interacts with folders and files, but my $PWD that it keeps pointing to /home/MyUserName directory and this messes with what it is supposed to do. I am running ...
3
votes
2answers
33 views

How to check every directory size using one shell command?

I want to get database sizes for - test, mysql, performance_schema, sakila, information_schema [root@linux data]# ls -ltrh 总用量 32M drwx------ 2 mysql root 4.0K 4月 27 17:44 test drwx------ 2 ...
0
votes
1answer
12 views

Pipe in Environment variable in fish shell doesn't execute the first command?

I want to set fish_greeting to date --rfc-2822 | cowsay -f tux | lolcat (don't judge me). When I run date --rfc-2822 | cowsay -f tux | lolcat interactively, I get the proper output (the date in a ...
0
votes
0answers
36 views

view files returned from shell commands

Very often I grep and find through directories (usually containing images) and I have to "visually" check the result before I can operate on the result (like deleting, moving, etc). E.g.: find ...
0
votes
0answers
25 views

How to have error output from `ls` if target directory is empty

I'm currently learning how to use the Linux shell, getting to grips with the basic commands like cd, ls and pwd. My file structure is like so: user |-- documents |-- file1.pdf |-- file2.txt ...
0
votes
2answers
41 views

From logs, extract specific line after a grep by line number

I have a file, debug.log, from which I want to extract all the lines that immediately precede a specified pattern. Example: 1 blabla 2 blabla 3 HERE THE IMPORTANT THING 4 HERE IT MATCHES MY PATTERN ...
20
votes
3answers
3k views

Why does clang generate unintelligible text when redirected?

I am trying to save the output of a command to a file. The command is: clang -Xclang -ast-dump -fsyntax-only main.cpp > output.txt However the resulting output.txt file when opened (by gedit and ...
1
vote
1answer
27 views

How to pass array to bash shell script?

How do I pass an array as a variable from a first bash shell script to a second script. first.sh #!/bin/bash AR=('foo' 'bar' 'baz' 'bat') sh second.sh "$AR" # foo sh second.sh "${AR[@]}" # foo ...
1
vote
1answer
18 views

Accessing array index variable from bash shell script loop

I want to access the array index variable while looping thru an array in my bash shell script. myscript.sh #!/bin/bash AR=('foo' 'bar' 'baz' 'bat') for i in ${AR[*]}; do echo $i done The result ...
0
votes
0answers
14 views

How do I launch/use Cygwin as the shell for TortoiseHg?

In the settings for TortoiseHg, there is an option to select what shell you would like to use. The two defaults listed are, as you might expect, "windows_command_prompt" and "powershell" but I would ...
0
votes
0answers
26 views

iTerm2 (OS X) change background image for current window from shell?

iTerm2 allows to set a background image or color, either for the current window or the default (used for all new windows). However, can I also set the current window's background image or color from ...
1
vote
1answer
44 views

CTRL+R in shell - if I go past the command I want, how do I get back to it?

I'm feverishly hitting CTRL+R to find some command I used awhile ago, when suddenly I get to it. By reflex, I continue hitting CTRL+R, passing it for something further back in the shell history. How ...
0
votes
2answers
317 views

How to run a bash script via absolute path?

I have a file: /Users/danylo.volokh/test/test_bash_script.sh Content is very simple: #!/usr/bin/env bash echo "-- print from script" I'm in folder "danylo.volokh" This command runs fine: ...
-1
votes
1answer
10 views

Printing file starting from matched line

Suppose there's a file with a structure like this Useless line 1 Useless line 2 ===USEFUL STUFF STARTS HERE=== Useful line 1 ... How can I print all the lines after the first line that matches ...
0
votes
2answers
34 views

Will changing windows shell affect my ability to run windows programs?

I have recently started using Linux on my laptop and I really like it. Especially I am overwhelmed by the ability to customize the desktop environment in Linux. I start reading about it and I learned ...
-2
votes
1answer
14 views

How to find & replace a pattern with string in ruby?

My file is: [root@test etc]# cat nrpe.cfg command[check_users]=/usr/local/nagios/libexec/check_users -w 30 -c 35 command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c ...
0
votes
2answers
23 views

How to add sizes of all files with the same name in UNIX Shell scripts

I'm new here and I want to ask how to add sizes of files with the same name? My file names are actually different from each other but I cut them so I could get files that are grouped together. here ...
3
votes
0answers
12 views

Wrap git's shell script to add bashrc or equivalent start-up commands

My server has a git user that handles all git access. You can't log in with it. It's only for git access. That works because GIT comes with a handly shell /usr/bin/git-shell. Login feedback: fatal: ...
1
vote
1answer
79 views

How to get bash-style autocompletion in zsh, (for git command)

I switched to zsh and find it better than bash, but I have a problem with oh-my-zsh's (hereafter "OMZ") autocomplete feature. When I type git chec, OMZ completes that to git check; in bash it gets ...
29
votes
8answers
7k views

Is it possible to restart a computer in response to an email notification?

I'm looking for a way to reboot machines after getting an email notification. The setup I want to use this on is a render farm. We have 5 boxes with 8 Nvidia GTX 980Ti in them. They're running ...
0
votes
1answer
29 views

How to run a shell script from an AppleScript?

I am using a Mac running OSX Yosemite v.10.10.5. When I try to run my shell script from my AppleScript, I get the following error message: Error message at AppleScript Script Editor error "sh: ...
0
votes
1answer
28 views

Decompress all gz files in a tree

I am working on an Ubuntu 14 server. Trying to create a tar.gz backup of my website, I accidentally gzipped every individual file in my /var/www/ directory, recursively. Now the whole tree consists ...
1
vote
1answer
22 views

Access to line arguments in shell script

I wonder if there is possible to access full command line call in shell script. In my script I need to pass it further. I find that there are $@ and $* accessors, but it do not pass all the ...
0
votes
2answers
14 views

display number of files in current moment like what tail -f do

I have a folder which files are copied to it like /home/my/. I want to run a command which shows number of files inside it in real time like what tail -f do with file contents. I know I should run ls ...
0
votes
1answer
21 views

Shell Save the array element values in the variables

I need to copy the files from one folder to another, here source and destination information are in the text file. File content: res.txt /var/lib/jenkins/jobs/Android\ Gradle\ test\ ...
-6
votes
1answer
33 views

converting shell script to bash script

can anyone help me by converting this shell script to bash script pl. my shell scrpit is as follows #!/bin/bash ...
0
votes
1answer
17 views

bash autocomplete fails with wildcard

Using bash on this this system: Linux 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt20-1+deb8u4 (2016-02-29) x86_64 GNU/Linux The sequence: cd /tmp touch test1.txt && touch test2.txt && ...
0
votes
1answer
20 views

Shell how to use a command to every regular file in and below the Dir

So what I have to do is find all regular files within and below the directory. For each of these regular files, I have to egrep for pattern($ARG) and find out if the output of the file matches the ...
0
votes
1answer
23 views

'\' backslash in single quotes giving unpredictable output in shell script linux

the output for the following two commands are same: echo 'my\name' | grep 'my\\name' my\name and also the output for the next command is also same, echo 'my\name' | grep 'my\\\name' my\name Can ...
0
votes
1answer
43 views

Use zsh if possible, bash if not

I have a couple of ubuntu machines and my home folder is shared across all of them. I think there is another computer, which holds the folder and it is mounted as I log in, not sure tough, I didn't ...
0
votes
2answers
41 views

Why the simplest Shell-Script isn't working?

I want hide the path in the Terminal and for that reason I typed: export PS1='> ' command which I found online with positive result. I thought to make it to a shell-script in order to not type ...
0
votes
0answers
41 views

Difference between su -c and runuser -l -c

I need to run some command lines as particular user in a shell script. I've found (at least) two way: su user -c 'command' runuser -l user -c 'command' Is there a significant difference between ...
0
votes
1answer
22 views

How to programatically modify systemd unit files?

I'd like to edit a systemd's unit file from a shell script. I want to change the unit's only ExecStart line. Using systemctl edit looks smart to me, but the command needs an editor set as ...
0
votes
0answers
35 views

What these options exactly mean in ifup command in Linux?

Please can someone explain to me more (maybe with examples ) about the following options in ifup command in Linux. This is what I found on the internet, but with no more details about it : ...