Tag: c

62 votes
22 answers
748 views
Use grep --exclude/--include syntax to not grep through certain files

I'm looking for the string foo= in text files in a directory tree. It's on a common Linux machine, I

avatar
Venice
0 1 0 9
asked 07 September, 2021
54 votes
16 answers
790 views
Count number of lines in a git repository

How would I count the total number of lines present in all the files in a git repository? git ls-files gives

avatar
Joseph
0 1 0 9
asked 07 September, 2021
54 votes
28 answers
1.7K views
Shell command to tar directory excluding certain files/folders

Is there a simple shell command/script that supports excluding certain files/folders from being archived? I h

avatar
Hilario
0 1 0 9
asked 07 September, 2021
61 votes
14 answers
307 views
How to echo shell commands as they are executed

In a shell script, how do I echo all shell commands called and expand any variable names? For example, given

avatar
Kisha
0 1 0 9
asked 07 September, 2021
61 votes
14 answers
782 views
How to reload .bash_profile from the command line?

How can I reload .bash_profile from the command line? I can get the shell to recognize changes to .bas

avatar
Bryan
0 1 0 9
asked 07 September, 2021
64 votes
20 answers
2.6K views
Running shell command and capturing the output

I want to write a function that will execute a shell command and return its output as a string, no matter, is

avatar
Rufus
0 1 0 9
asked 07 September, 2021
53 votes
23 answers
1.4K views
How can I declare and use Boolean variables in a shell script?

I tried to declare a Boolean variable in a shell script using the following syntax: variable=$false variable

avatar
Freida
0 1 0 9
asked 07 September, 2021
61 votes
20 answers
1.1K views
How to use SSH to run a local shell script on a remote machine?

I have to run a local shell script (windows/Linux) on a remote machine. I have SSH configured on both machine

avatar
Dusty
0 1 0 9
asked 07 September, 2021
58 votes
21 answers
909 views
How to convert a string to lower case in Bash?

Is there a way in bash to convert a string into a lower case string? For example, if I have: a="Hi all" I

avatar
Tuan
0 1 0 9
asked 07 September, 2021
61 votes
30 answers
1.2K views
How do I prompt for Yes/No/Cancel input in a Linux shell script?

I want to pause input in a shell script, and prompt the user for choices. The standard Yes, No, or Cancel type

avatar
Kristopher
0 1 0 9
asked 07 September, 2021
59 votes
14 answers
1.1K views
How do I set a variable to the output of a command in Bash?

I have a pretty simple script that is something like the following: #!/bin/bash VAR1="$1" MOREF='sudo r

avatar
Elicia
0 1 0 9
asked 07 September, 2021
53 votes
19 answers
1.4K views
How to delete from a text file, all lines that contain a specific string?

How would I use sed to delete all lines in a text file that contain a specific string?

avatar
Fabian
0 1 0 9
asked 07 September, 2021
47 votes
16 answers
1.6K views
How to mkdir only if a directory does not already exist?

I am writing a shell script to run under the KornShell (ksh) on AIX. I would like to use the mkdir command to

avatar
Yolando
0 1 0 9
asked 07 September, 2021
48 votes
30 answers
1.1K views
How do I split a string on a delimiter in Bash?

I have this string stored in a variable: IN="[email protected];[email protected]" Now I would like to split the stri

avatar
Lynette
0 1 0 9
asked 07 September, 2021
62 votes
18 answers
403 views
In the shell, what does " 2>&1 " mean?

In a Unix shell, if I want to combine stderr and stdout into the stdout stream for further manipulation, I can

avatar
Renaldo
0 1 0 9
asked 07 September, 2021
52 votes
12 answers
1.3K views
How do I copy a folder from remote to local using scp?

How do I copy a folder from remote to local host using scp? I use ssh to log in my server. Then, I would like

avatar
Scot
0 1 0 9
asked 07 September, 2021
51 votes
30 answers
1.5K views
How to concatenate string variables in Bash

In PHP, strings are concatenated together as follows: $foo = "Hello"; $foo .= " World"; Here, $foo becomes

avatar
Luis
0 1 0 9
asked 07 September, 2021
62 votes
5 answers
2.6K views
Why split the View in MVC into a view class and a template

I'm relatively new to design patterns but I feel that I've got a good understanding of the MVC patte

avatar
Denese
0 1 0 9
asked 07 September, 2021
60 votes
4 answers
2.7K views
joomla BASE HREF uses HTTP instead of HTTPS

I wanted to change my site from http to https. Always. So I configured my apache accordingly. Now when I ente

avatar
Kisha
0 1 0 9
asked 07 September, 2021
67 votes
1 answers
2.1K views
What are the differences between Joomla Model Types?

I'm trying to get to grips with the power behind Joomla (3.x)'s framework. I've noticed that th

avatar
Benton
0 1 0 9
asked 07 September, 2021