scripting

How to concat variable and string in bash script

谁都会走 提交于 2020-03-13 05:23:27
问题 How to concat variable and string in bash script ? val1 = Variable1 + "any string " eg : val1 = $i + "-i-*" where i = 24thMarch I want echo val1 : 24thMarch-i-* What is proper proper to get the solution ? 回答1: Strings are concatenated by default in the shell. value="$variable"text"$other_variable" It's generally considered good practice to wrap variable expansions in double quotes. You can also do this: value="${variable}text${other_variable}" The curly braces are useful when dealing with a

How to concat variable and string in bash script

强颜欢笑 提交于 2020-03-13 05:21:40
问题 How to concat variable and string in bash script ? val1 = Variable1 + "any string " eg : val1 = $i + "-i-*" where i = 24thMarch I want echo val1 : 24thMarch-i-* What is proper proper to get the solution ? 回答1: Strings are concatenated by default in the shell. value="$variable"text"$other_variable" It's generally considered good practice to wrap variable expansions in double quotes. You can also do this: value="${variable}text${other_variable}" The curly braces are useful when dealing with a

How do I automatically remove all protections that exist on a cell in Google Sheets when I (the owner of the workbook) clear its contents?

妖精的绣舞 提交于 2020-03-04 06:19:07
问题 I'm currently using Google Sheets as a way for people to sign up for certain time shifts. I'm using the following script to automatically protect cells after data entry so that people can't discretely erase their signups without notifying me: function onEdit(e) { var range = e.range; var timeZone = Session.getScriptTimeZone(); var stringDate = Utilities.formatDate(new Date(), timeZone, 'dd/MM/yy HH:mm'); var description = 'Protected on ' + stringDate; var protection = range.protect()

Is there any good reason for javascript to be inline

不羁的心 提交于 2020-02-28 02:32:02
问题 I've been building a site. At some stage I noticed that IE display was a little broken and Chrome had all but rendered nothing but the body tag (empty), and FF all looked good. After throwing my keyboard around the room and bashing my head against my mouse, I discovered the problem. I had left (don't ask how or why, must have been some lightning speed cut and paste error) an HTML comment unclosed in an inline script block. <script type="text/javascript"> <!-- ... </script> I'm guessing (not

Is there any good reason for javascript to be inline

百般思念 提交于 2020-02-28 02:30:45
问题 I've been building a site. At some stage I noticed that IE display was a little broken and Chrome had all but rendered nothing but the body tag (empty), and FF all looked good. After throwing my keyboard around the room and bashing my head against my mouse, I discovered the problem. I had left (don't ask how or why, must have been some lightning speed cut and paste error) an HTML comment unclosed in an inline script block. <script type="text/javascript"> <!-- ... </script> I'm guessing (not

MS Batch: Check if drive is in use

☆樱花仙子☆ 提交于 2020-02-24 09:07:26
问题 I need to check if a drive (Z:) is in use (e.g. in use by an application, opened). My Batch File looks like this: Mount Z: wait 15 minutes check if drive Z: is in use IF NOT: unmount Z: ELSE: wait 15 minutes repeat.. Is there any Command for this? Thanks! 回答1: Use the IF EXIST or IF NOT EXIST combination: :FindDrive if exist Z:\nul goto Mounted timeout /T 5 goto FindDrive :Mounted NUL is the a 'virtual' file that exists in every folder. So if c:\anypath\nul exists, the drive exists. 回答2:

Batch Scripting Backing up files in USB

你说的曾经没有我的故事 提交于 2020-02-23 04:43:08
问题 Iv got my code to show a list of USb devices connected to my laptop and i can select the USB as well but when i try to back up a folder into the USB what i get instead is a folder named f in the folder i was trying to save. This is the code i have for selectong a USB device for /f "delims=" %%a in ('wmic logicaldisk where drivetype^=2 get deviceid ^| find ":"') do set "$List=!$List! %%a" :USB echo Avaiable Drive ==^> !$List! set /p "$Drive=Enter the letter of the Backup drive : " echo !$List!

Sendmail command to send a file as an email body as well as attachment [duplicate]

家住魔仙堡 提交于 2020-02-22 19:05:26
问题 This question already has answers here : How do I send a file as an email attachment using Linux command line? (26 answers) Closed 2 years ago . I want to send an email using sendmail command in bash . The email should get it's body by reading Input_file_HTML and it should send same input file as an attachment too. To do so I have tried the following. sendmail_touser() { cat - ${Input_file_HTML} << EOF | /usr/sbin/sendmail -oi -t From: ${MAILFROM} To: ${MAILTO} Subject: $1 Content-Type: text

CMD Script: How to close the CMD

爱⌒轻易说出口 提交于 2020-02-20 08:03:13
问题 I have created a small command that will let me launch Internet Explorer. However, I wish to close the small command prompt that shows up when I launch IE. How can I do this? This is my current code: "%ProgramFiles%\Internet Explorer\iexplore.exe" http://localhost/test.html PAUSE I am guessing if I take out the Pause. It will close the CMD box upon closing IE?? Also is there another command that I can use to simply create a command that will let me add something to the Menu with a small icon,

How do I create a custom type in PowerShell for my scripts to use?

北慕城南 提交于 2020-02-12 05:49:06
问题 I would like to be able to define and use a custom type in some of my PowerShell scripts. For example, let's pretend I had a need for an object that had the following structure: Contact { string First string Last string Phone } How would I go about creating this so that I could use it in function like the following: function PrintContact { param( [Contact]$contact ) "Customer Name is " + $contact.First + " " + $contact.Last "Customer Phone is " + $contact.Phone } Is something like this